/*
 * Mobile Responsive Styles
 * Этап 1: Базовая адаптивность
 * ========================================
 */

/* Убираем минимальную ширину для мобильных */
body {
    min-width: 100% !important;
}

/* ========================================
 * Hamburger Menu Button
 * ======================================== */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    min-width: unset !important;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #012546;
    margin: 5px auto;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
 * Mobile Menu Overlay
 * ======================================== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* ========================================
 * Mobile Menu Panel
 * ======================================== */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu__header {
    padding: 15px 20px;
    border-bottom: 1px solid #f3f8fa;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu__close {
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #727fa1;
    min-width: unset !important;
    padding: 0;
}

.mobile-menu__user {
    padding: 15px 20px;
    background: #f3f8fa;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu__user-name {
    font-weight: 600;
    font-size: 14px;
    color: #012546;
}

.mobile-menu__user-email {
    font-size: 12px;
    color: #727fa1;
    margin-top: 3px;
}

.mobile-menu__nav {
    padding: 10px 0;
}

.mobile-menu__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    color: #012546;
    text-decoration: none;
    border-bottom: 1px solid #f3f8fa;
    transition: background 0.2s ease;
}

.mobile-menu__link:hover {
    background: #f3f8fa;
    color: #0075ff;
}

.mobile-menu__link svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #727fa1;
}

.mobile-menu__link:hover svg {
    stroke: #0075ff;
}

.mobile-menu__divider {
    height: 1px;
    background: #e0e0e0;
    margin: 10px 20px;
}

.mobile-menu__section-title {
    padding: 10px 20px 5px;
    font-size: 11px;
    font-weight: 600;
    color: #b5bbca;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu__buttons {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu__buttons .btn {
    width: 100%;
    text-align: center;
}

/* ========================================
 * Мобильные устройства (до 768px)
 * ======================================== */
@media screen and (max-width: 768px) {

    /* Показываем hamburger menu */
    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-menu-overlay.active {
        pointer-events: auto;
    }

    .mobile-menu {
        display: block;
    }

    /* Базовые стили */
    body {
        font-size: 14px;
    }

    /* Контейнеры */
    .container,
    .container_medium,
    .container_large {
        padding: 0 15px;
        max-width: 100%;
    }

    body.has-sidebar .container {
        margin-left: 0;
        width: 100%;
    }

    body.has-sidebar .container_medium {
        margin-left: 0;
        width: 100%;
    }

    /* Заголовки */
    .page-title {
        font-size: 28px;
    }

    .section-title {
        font-size: 24px;
        line-height: 1.3;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-title::after {
        width: 100%;
        margin-bottom: 0;
    }

    /* Кнопки */
    .btn, button {
        min-width: unset;
        padding: 12px 15px;
        font-size: 16px;
    }

    .btn_icon, button_icon {
        gap: 8px;
    }

    /* Header */
    .header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header__inner {
        padding: 10px 0;
        gap: 10px;
        justify-content: space-between;
    }

    .header__logo {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        order: 0;
    }

    .header__logo img {
        height: 35px !important;
    }

    .header__column {
        max-width: none;
        flex-grow: 0;
        width: auto;
    }

    .header__column_left {
        display: none;
    }

    .header__column_right {
        gap: 5px;
        display: flex;
        align-items: center;
    }

    /* Скрываем элементы на мобильных */
    .header__auth {
        display: none !important;
    }

    .header__menu {
        display: none;
    }

    .header__user {
        display: none;
    }

    .header__notifications {
        display: none;
    }

    .visitor-counter {
        display: none !important;
    }

    /* Язык - компактный */
    .header__lang {
        margin-left: 0;
    }

    .lang__current {
        padding: 8px 10px;
        font-size: 12px;
    }

    .lang__current::after {
        width: 8px;
        height: 5px;
    }

    .lang__list {
        right: 0;
        left: auto;
        min-width: 80px;
    }

    /* Sidebar - скрываем на мобильных */
    .sidebar {
        display: none;
    }

    /* Intro секция */
    .intro__inner {
        min-height: calc(100vh - 60px);
        padding: 60px 0 40px;
    }

    .intro__title {
        font-size: 24px;
        line-height: 1.4;
    }

    .intro__title::after {
        width: 200px;
        height: 110px;
    }

    .intro__btn {
        min-width: 100%;
        margin: 30px auto 0;
    }

    .intro__buttons {
        margin: 30px 0 0;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .intro__buttons-item {
        padding: 15px 12px;
        font-size: 14px;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        padding: 15px 0 10px;
        font-size: 11px;
        flex-wrap: wrap;
    }

    /* Таблицы - горизонтальный скролл */
    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }

    /* Фильтры */
    .filter {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0 30px;
    }

    .filter__search,
    .filter__version,
    .filter__year,
    .filter__status,
    .filter__type {
        max-width: 100%;
        width: 100%;
    }

    /* Tabs */
    .tabs {
        flex-direction: column;
        gap: 0;
        margin: 20px 0;
    }

    .tabs__link {
        padding: 12px;
        border-bottom: 1px solid rgba(114, 127, 162, 0.09);
        border-left: 3px solid transparent;
    }

    .tabs__link_active {
        border-bottom-color: rgba(114, 127, 162, 0.09);
        border-left-color: #0075ff;
    }

    .tabs__button {
        margin: 10px 0 0;
        width: 100%;
    }

    /* Pagination */
    .pagination {
        margin: 20px 0;
        gap: 4px;
        flex-wrap: wrap;
    }

    .pagination__item {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    /* Forms */
    .form input,
    .form textarea,
    .form select {
        padding: 12px 15px;
        font-size: 14px;
    }

    .form__label {
        font-size: 13px;
    }

    /* Popup */
    .popup__block {
        margin: 20px auto;
        max-width: calc(100% - 30px);
        min-height: unset;
        grid-template-columns: 1fr;
    }

    .popup__col_left {
        display: none;
    }

    .popup__col_right {
        padding: 40px 20px;
    }

    .popup__title {
        font-size: 24px;
    }

    /* Footer */
    .footer {
        padding: 40px 0 50px;
    }

    .footer__list {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    /* Systems секция */
    .systems {
        margin: 50px 0 40px;
    }

    .systems__wrapper {
        flex-direction: column;
        margin: 25px 0 0;
    }

    .systems__menu {
        max-width: 100%;
        margin-top: 0;
    }

    .systems__link {
        padding: 12px 15px;
        font-size: 14px;
    }

    .systems__illustration {
        display: none;
    }

    /* Stack секция */
    .stack {
        margin: 40px 0;
        padding: 50px 0;
    }

    .stack__wrapper {
        grid-template-columns: 1fr;
        margin: 40px 0 0;
    }

    .stack__chart {
        max-width: 250px;
        margin: 0 auto;
    }

    /* Questions секция */
    .questions {
        padding: 0 0 60px;
    }

    .questions__wrapper {
        flex-direction: column;
    }

    .questions__form,
    .questions__last,
    .questions__list {
        width: 100%;
        max-width: 100%;
    }

    .questions__list-row {
        grid-template-columns: 1fr;
        padding-right: 0;
    }

    .questions__list-row > *:not(:first-child) {
        text-align: left;
    }

    /* Geo секция */
    .geo__wrapper {
        flex-direction: column;
    }

    .geo__map {
        display: none;
    }

    .geo__info {
        max-width: 100%;
    }

    .geo__info-list {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
    }

    .geo__region {
        padding: 10px;
    }

    .geo__region-name {
        font-size: 14px;
    }

    /* IS Info */
    .is-info__body {
        grid-template-columns: 1fr;
    }

    .is-info__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .is-info__header-title {
        font-size: 16px;
    }

    .is-info__row {
        flex-direction: column;
        gap: 5px;
        padding: 15px;
    }

    .is-info__row > *:first-child {
        max-width: 100%;
    }

    /* IS Menu Navigation */
    .is-menu-navigation {
        grid-template-columns: 1fr;
    }

    .is-menu {
        width: 100%;
    }

    /* IS Classifier */
    .is-classifier__wrapper {
        grid-template-columns: 1fr;
    }

    /* Actions */
    .actions {
        flex-direction: column;
        gap: 10px;
    }

    .actions__btn {
        width: 100%;
    }

    /* Buttons wrapper */
    .buttons-wrapper {
        flex-direction: column;
    }

    .buttons-wrapper .btn {
        width: 100%;
    }

    /* Admin panel */
    .admin-panel {
        width: 100%;
    }

    .admin-panel__wrapper {
        flex-direction: column;
    }

    /* Budget order */
    .budget-order__header {
        flex-direction: column;
        align-items: stretch;
    }

    .budget-order__row {
        flex-direction: column;
        padding: 15px 20px;
        gap: 10px;
    }

    .budget-order__row .form__field {
        max-width: 100%;
    }

    /* Export */
    .export {
        width: 100%;
    }

    .export__form-wrapper {
        grid-template-columns: 1fr;
    }

    /* IS Tabs */
    .is-tabs {
        flex-direction: column;
        margin: 30px 0 20px;
    }

    .is-tabs .tabs__link {
        flex-direction: row;
        align-items: center;
    }

    /* Comments sidebar */
    .comments {
        width: 100%;
        right: -100%;
    }

    .comments_active {
        right: 0;
    }

    /* Status badges */
    .status {
        font-size: 11px;
        padding: 1px 6px;
    }

    /* Tooltip */
    .tooltip__content {
        width: 280px;
        left: auto;
        right: 0;
        transform: none;
    }
}

/* ========================================
 * Маленькие мобильные (до 480px)
 * ======================================== */
@media screen and (max-width: 480px) {

    body {
        font-size: 13px;
    }

    .container,
    .container_medium,
    .container_large {
        padding: 0 10px;
    }

    .page-title {
        font-size: 22px;
    }

    .section-title {
        font-size: 20px;
    }

    .intro__title {
        font-size: 20px;
    }

    .intro__title::after {
        width: 150px;
        height: 80px;
    }

    .header__auth {
        padding: 8px 10px;
        font-size: 11px;
    }

    .btn, button {
        padding: 10px 12px;
        font-size: 14px;
    }

    .popup__col_right {
        padding: 30px 15px;
    }

    .popup__title {
        font-size: 20px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 11px;
    }
}

/* ========================================
 * Планшеты (768px - 1024px)
 * ======================================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    body {
        min-width: 100% !important;
    }

    .container,
    .container_medium,
    .container_large {
        padding: 0 20px;
    }

    body.has-sidebar .container {
        margin-left: 54px;
        width: calc(100% - 54px);
    }

    .intro__buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .systems__wrapper {
        flex-direction: column;
    }

    .systems__menu {
        max-width: 100%;
    }

    .systems__illustration {
        width: 100%;
        right: 0;
        max-width: 500px;
        margin: 30px auto 0;
    }

    .stack__wrapper {
        grid-template-columns: 1fr 1fr;
    }

    .stack__chart {
        grid-column: span 2;
        max-width: 300px;
        margin: 0 auto 20px;
    }

    .questions__wrapper {
        flex-wrap: wrap;
    }

    .questions__form,
    .questions__last {
        width: calc(50% - 10px);
    }

    .questions__list {
        width: 100%;
        max-width: 100%;
    }

    .is-info__body {
        grid-template-columns: 1fr;
    }

    .geo__map {
        transform: scale(0.4);
    }
}

/* ========================================
 * Средние экраны (1024px - 1260px)
 * ======================================== */
@media screen and (min-width: 1025px) and (max-width: 1260px) {

    body {
        min-width: 100% !important;
    }

    .container {
        max-width: 100%;
        padding: 0 30px;
    }

    .intro__buttons {
        grid-template-columns: repeat(3, minmax(auto, 300px));
    }

    .systems__illustration {
        width: 550px;
        right: 0;
    }
}

/* ========================================
 * Mobile Sidebar Toggle Button
 * ======================================== */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0075ff 0%, #0056cc 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 998;
    box-shadow: 0 4px 15px rgba(0, 117, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 0;
    min-width: unset !important;
}

.mobile-sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 117, 255, 0.5);
}

.mobile-sidebar-toggle:active {
    transform: scale(0.95);
}

.mobile-sidebar-toggle svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    stroke: #fff;
}

/* ========================================
 * Mobile Sidebar Overlay
 * ======================================== */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
}

/* ========================================
 * Mobile Sidebar Panel
 * ======================================== */
.sidebar.mobile-sidebar-active {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 280px !important;
    height: 100% !important;
    z-index: 1002 !important;
    overflow-y: auto !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    background: #012546 !important;
    padding: 0 !important;
}

.sidebar.mobile-sidebar-active.open {
    transform: translateX(0);
}

/* Mobile Sidebar Header */
.mobile-sidebar-header {
    display: none;
    padding: 15px 20px;
    background: linear-gradient(135deg, #012546 0%, #023b6e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: space-between;
}

.mobile-sidebar-header__title {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.mobile-sidebar-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    min-width: unset !important;
    padding: 0;
}

.mobile-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-sidebar-close svg {
    width: 16px;
    height: 16px;
    fill: #fff;
    stroke: #fff;
}

/* Mobile Sidebar Menu Styles */
@media screen and (max-width: 768px) {

    /* Show toggle button on mobile */
    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide toggle when sidebar is open */
    .mobile-sidebar-toggle.hidden {
        display: none;
    }

    .mobile-sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-sidebar-overlay.active {
        pointer-events: auto;
    }

    /* Mobile sidebar header */
    .sidebar.mobile-sidebar-active .mobile-sidebar-header {
        display: flex;
    }

    /* Adjust sidebar menu for mobile */
    .sidebar.mobile-sidebar-active .sidebar__menu {
        padding: 0;
    }

    .sidebar.mobile-sidebar-active .sidebar__list {
        padding: 10px 0;
        margin: 0;
        list-style: none;
    }

    .sidebar.mobile-sidebar-active .sidebar__item {
        margin: 0;
        position: relative;
    }

    /* IMPORTANT: Reset link width and show text */
    .sidebar.mobile-sidebar-active .sidebar__link {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 14px;
        display: flex !important;
        align-items: center;
        gap: 12px;
        color: #fff !important;
        text-decoration: none;
        border-left: 3px solid transparent;
        transition: all 0.2s ease;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__link:hover {
        background: rgba(255, 255, 255, 0.1);
        border-left-color: #0075ff;
        color: #fff !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__item_active > .sidebar__link {
        background: rgba(0, 117, 255, 0.2);
        border-left-color: #0075ff;
    }

    /* IMPORTANT: Show text span */
    .sidebar.mobile-sidebar-active .sidebar__link span {
        display: inline !important;
        opacity: 1 !important;
        white-space: normal !important;
        color: #fff !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__link svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        stroke: #fff !important;
    }

    /* Reset submenu positioning for mobile */
    .sidebar.mobile-sidebar-active .sidebar__submenu {
        display: none !important;
        position: static !important;
        width: 100% !important;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        background: rgba(0, 0, 0, 0.2) !important;
        padding: 5px 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__submenu::before {
        display: none !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__item_has-submenu.open > .sidebar__submenu {
        display: block !important;
    }

    /* Don't show submenu on hover in mobile */
    .sidebar.mobile-sidebar-active .sidebar__item:hover .sidebar__submenu {
        display: none !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__item_has-submenu.open:hover .sidebar__submenu {
        display: block !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__submenu-item {
        margin: 0;
    }

    .sidebar.mobile-sidebar-active .sidebar__submenu-link {
        padding: 12px 20px 12px 55px !important;
        font-size: 13px;
        color: rgba(255, 255, 255, 0.8) !important;
        display: block;
        text-decoration: none;
        transition: all 0.2s ease;
    }

    .sidebar.mobile-sidebar-active .sidebar__submenu-link:hover {
        background: rgba(255, 255, 255, 0.05);
        color: #fff !important;
    }

    .sidebar.mobile-sidebar-active .sidebar__submenu-item_active > .sidebar__submenu-link {
        color: #4da3ff !important;
        background: rgba(0, 117, 255, 0.15);
    }

    /* Hide toggle button in sidebar */
    .sidebar.mobile-sidebar-active .sidebar__toggle {
        display: none !important;
    }

    /* Submenu arrow indicator */
    .sidebar.mobile-sidebar-active .sidebar__item_has-submenu > .sidebar__link::after {
        content: '';
        width: 8px;
        height: 8px;
        border-right: 2px solid rgba(255, 255, 255, 0.5);
        border-bottom: 2px solid rgba(255, 255, 255, 0.5);
        transform: rotate(-45deg);
        margin-left: auto;
        transition: transform 0.2s ease;
        flex-shrink: 0;
    }

    .sidebar.mobile-sidebar-active .sidebar__item_has-submenu.open > .sidebar__link::after {
        transform: rotate(45deg);
    }

    /* Add class for items without span (like expertise) */
    .sidebar.mobile-sidebar-active .sidebar__item .sidebar__link {
        font-weight: 600;
        line-height: 1.4;
    }
}

/* ========================================
 * Additional Mobile Fixes
 * ======================================== */
@media screen and (max-width: 768px) {

    /* D-Flex responsive */
    .d-flex {
        flex-wrap: wrap;
    }

    /* Filter expertise styles */
    .filter_expertise {
        flex-direction: column;
        gap: 10px !important;
    }

    .filter_expertise .filter__search,
    .filter_expertise .filter__type,
    .filter_expertise .filter__year,
    .filter_expertise .form__field {
        max-width: 100% !important;
        width: 100% !important;
    }

    .filter_expertise .ms-auto {
        margin-left: 0 !important;
        width: 100%;
    }

    .filter_expertise .ms-auto .btn {
        width: 100%;
    }

    .filter_expertise .align-content-center {
        text-align: left;
        padding: 5px 0;
    }

    /* Inline grid styles override */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        display: block !important;
    }

    [style*="grid-template-columns: 1fr 1fr"] > *,
    [style*="grid-template-columns:1fr 1fr"] > * {
        margin-bottom: 10px;
    }

    /* Tab numbers */
    .tabs__num {
        font-size: 11px;
        padding: 2px 6px;
        min-width: 20px;
    }

    /* Success/Error boxes */
    .success-info,
    .info-box-error {
        padding: 12px 15px;
        font-size: 13px;
        margin-bottom: 15px;
    }

    /* Card styles */
    [style*="border-radius: 8px"][style*="box-shadow"],
    .card {
        padding: 15px !important;
        margin-bottom: 15px;
    }

    /* KPI cards */
    [style*="display: grid"][style*="gap: 20px"] {
        display: block !important;
    }

    [style*="display: grid"][style*="gap: 20px"] > * {
        margin-bottom: 15px;
    }

    /* Stats grid */
    .stats-grid,
    [style*="grid-template-columns: repeat(4"] {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Profile page fixes */
    .profile__info {
        flex-direction: column;
    }

    .profile__avatar {
        margin-bottom: 15px;
    }

    /* Expertise tabs buttons */
    .tabs__button {
        width: 100%;
        margin-top: 10px;
    }

    /* Table responsive wrapper */
    .table-responsive,
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* IS info page */
    .is-info__body {
        display: block !important;
    }

    .is-info__left,
    .is-info__right {
        width: 100% !important;
        margin-bottom: 20px;
    }

    /* Budget order */
    .budget-order {
        overflow-x: auto;
    }

    .budget-order__table {
        min-width: 600px;
    }

    /* Comments section */
    .comments {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Document list */
    .document-list,
    .docs-list {
        grid-template-columns: 1fr !important;
    }

    /* Form groups in rows */
    .form__row,
    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .form__row > *,
    .form-row > * {
        width: 100%;
        max-width: 100%;
    }

    /* Input groups */
    .input-group {
        flex-wrap: wrap;
    }

    .input-group > input,
    .input-group > select {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Modal fixes */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10% auto !important;
        padding: 15px !important;
    }

    .modal-content h2 {
        font-size: 18px;
    }

    /* Expertise info header */
    .expertise-info__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Action buttons */
    .action-buttons,
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    .action-buttons .btn,
    .btn-group .btn {
        width: 100%;
    }

    /* Select2 */
    .select2-container {
        width: 100% !important;
    }

    /* DataTables */
    .dataTables_wrapper {
        overflow-x: auto;
    }

    .dataTables_filter input {
        width: 150px !important;
    }

    .dataTables_length select {
        padding: 5px 10px;
    }

    /* Sticky header on scroll */
    .sticky-header {
        position: sticky;
        top: 60px;
        z-index: 50;
        background: #fff;
    }
}

/* ========================================
 * Touch Improvements
 * ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    button,
    .tabs__link,
    .sidebar__link,
    .mobile-menu__link {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    button:hover {
        transform: none;
    }

    /* Improve scrolling */
    .table,
    .dataTables_wrapper,
    .overflow-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
 * Public Pages Mobile Styles
 * ======================================== */
@media screen and (max-width: 768px) {

    /* Geo section (header with background) */
    .geo {
        height: auto !important;
        min-height: 120px;
        padding: 20px 0;
    }

    .geo .page-title {
        font-size: 22px;
        line-height: 1.3;
    }

    /* Questions page */
    .questions__wrapper {
        flex-direction: column;
        gap: 30px;
    }

    .questions__list,
    .questions__last,
    .questions__form {
        width: 100% !important;
        max-width: 100% !important;
    }

    .questions__list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .questions__list-btn {
        width: 100%;
    }

    .questions__list-heading,
    .questions__list-row {
        grid-template-columns: 1fr !important;
        gap: 8px;
        padding: 15px;
    }

    .questions__list-heading > div:not(:first-child),
    .questions__list-row > div:not(:first-child) {
        display: inline-block;
        font-size: 12px;
        color: #727fa1;
    }

    .questions__list-heading > div:not(:first-child)::before {
        content: attr(data-label);
        margin-right: 5px;
    }

    .questions__list-item-title {
        font-size: 15px;
    }

    .questions__list-item-description {
        font-size: 13px;
    }

    .questions__last {
        order: -1;
    }

    .questions__last-title {
        font-size: 18px;
    }

    .questions__last-item {
        padding: 12px;
    }

    /* Etalon data page */
    .is-menu-navigation {
        flex-direction: column;
        gap: 20px;
    }

    .is-menu {
        width: 100%;
        max-width: 100%;
    }

    .is-menu__title {
        padding: 12px 15px;
        font-size: 14px;
    }

    .is-menu__list {
        max-height: 250px;
        overflow-y: auto;
    }

    .is-menu__item {
        padding: 10px 15px;
        font-size: 13px;
    }

    .is-menu-content {
        width: 100%;
    }

    .is-content-title {
        font-size: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* Tabs in etalon */
    .tab.tabs {
        flex-wrap: wrap;
        gap: 5px;
    }

    .tab.tabs .tabs__link {
        flex: 1 1 auto;
        min-width: 45%;
        text-align: center;
        padding: 10px 15px !important;
        font-size: 13px;
    }

    /* Grades page */
    .filter.form {
        flex-direction: column;
        gap: 15px;
    }

    .filter.form .filter__type,
    .filter.form .form__field {
        width: 100%;
        max-width: 100%;
    }

    .filter.form .form__field select {
        width: 100%;
    }

    .filter.form .budget-order__submit {
        width: 100%;
    }

    /* Chart section */
    .chart {
        overflow-x: auto;
    }

    .chart__block {
        padding: 20px !important;
        min-width: 600px;
    }

    .chart__title {
        font-size: 16px;
    }

    .chart__x {
        gap: 5px;
    }

    .chart__bar {
        min-width: 20px;
    }

    /* Infosys tables */
    .table .table__name a {
        word-break: break-word;
        white-space: normal;
    }

    /* Stack/Technologies section */
    .stack__wrapper {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .stack__col {
        width: 100%;
    }

    .stack__chart {
        order: -1;
        max-width: 200px;
        margin: 0 auto 20px;
    }

    .stack__technology {
        padding: 10px;
        gap: 10px;
    }

    .stack__technology-name {
        font-size: 12px;
        line-height: 1.3;
    }

    .stack__technology-count {
        min-width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .stack__technology-img {
        width: 35px;
        height: 35px;
    }

    /* Systems section on main page */
    .systems__wrapper {
        flex-direction: column;
    }

    .systems__menu {
        max-width: 100%;
        width: 100%;
    }

    .systems__list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .systems__link {
        padding: 12px 15px;
        font-size: 14px;
    }

    .systems__count {
        font-size: 14px;
        min-width: 35px;
    }

    .systems__illustration {
        display: none;
    }

    /* Login popup mobile */
    .popup__block {
        grid-template-columns: 1fr !important;
        min-height: auto;
        max-width: 95%;
        margin: 20px auto;
    }

    .popup__col_left {
        display: none !important;
    }

    .popup__col_right {
        padding: 30px 20px;
    }

    .popup__form {
        gap: 15px;
    }

    .popup__form .form__field {
        margin-bottom: 10px;
    }

    .popup__form .btn {
        width: 100%;
    }

    .popup__bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    /* Info page (public IS view) */
    .infosys-info {
        padding: 15px;
    }

    .infosys-info__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .infosys-info__title {
        font-size: 18px;
    }

    .infosys-info__row {
        flex-direction: column;
        gap: 5px;
    }

    .infosys-info__label {
        font-size: 12px;
    }

    .infosys-info__value {
        font-size: 14px;
    }

    /* Ask question form */
    .questions__form-wrapper {
        padding: 20px;
    }

    .questions__form-title {
        font-size: 18px;
    }

    .questions__form .form__field {
        margin-bottom: 15px;
    }

    .questions__form textarea {
        min-height: 120px;
    }

    /* Footer mobile */
    .footer__inner {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer__logo {
        margin: 0 auto;
    }

    .footer__list {
        justify-content: center;
    }

    .footer__item {
        font-size: 13px;
    }

    /* Announcements page */
    .announcements-list {
        grid-template-columns: 1fr !important;
    }

    .announcement-card {
        padding: 15px;
    }

    .announcement-card__title {
        font-size: 16px;
    }

    .announcement-card__date {
        font-size: 12px;
    }

    /* Digital transformation maps */
    .dt-maps__wrapper {
        grid-template-columns: 1fr !important;
    }

    .dt-map-card {
        padding: 15px;
    }

    /* IS Documents page */
    .is-documents__list {
        grid-template-columns: 1fr !important;
    }

    .is-document-card {
        padding: 15px;
    }

    /* Calculator page - own layout */
    .calculator-container {
        padding: 15px;
    }

    .calculator-tabs {
        flex-wrap: wrap;
    }

    .calculator-tab {
        flex: 1 1 auto;
        min-width: 45%;
        text-align: center;
    }

    .calculator-section {
        padding: 15px;
    }

    .calculator-input-group {
        flex-direction: column;
    }

    .calculator-input {
        width: 100%;
    }

    .calculator-result {
        font-size: 18px;
    }
}

/* ========================================
 * Small Mobile Public Pages (< 480px)
 * ======================================== */
@media screen and (max-width: 480px) {

    .geo .page-title {
        font-size: 18px;
    }

    .systems__link {
        padding: 10px 12px;
        font-size: 13px;
    }

    .systems__count {
        font-size: 12px;
        min-width: 30px;
    }

    .stack__technology-name {
        font-size: 11px;
    }

    .questions__list-item-title {
        font-size: 14px;
    }

    .tab.tabs .tabs__link {
        min-width: 100%;
        font-size: 12px;
    }
}
