/* Глобальные стили */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Базовые стили для контейнеров */
.documents-container {
    width: 100%;
    max-width: 1952px; /* 1432px контент + 260px*2 отступы */
    margin: 0 auto;
    padding-left: 260px;
    padding-right: 260px;
}

/* Контейнер с ограничением ширины для контента */
.content-wrapper {
    max-width: 1432px;
    margin: 0 auto;
    width: 100%;
}

/* Базовые стили для мобильного меню */
.mobile-menu-button {
    display: none;
}

/* Адаптивные стили для больших экранов */
@media (min-width: 1953px) {
    /* Контейнер уже имеет фиксированную ширину */
}

/* Большие планшеты и маленькие ноутбуки */
@media (max-width: 1536px) {
    .documents-container {
        padding-left: 160px;
        padding-right: 160px;
        max-width: 1752px; /* 1432px + 160px*2 */
    }
}

@media (max-width: 1440px) {
    .documents-container {
        padding-left: 120px;
        padding-right: 120px;
    }
}

/* Планшеты */
@media (max-width: 1280px) {
    .documents-container {
        padding-left: 80px;
        padding-right: 80px;
    }
}

/* Средние планшеты */
@media (max-width: 1024px) {
    .documents-container {
        padding-left: 40px;
        padding-right: 40px;
    }
    
    /* Показываем кнопку мобильного меню */
    .mobile-menu-button {
        display: flex;
    }
    
    /* Скрываем десктопное меню */
    .desktop-nav {
        display: none !important;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .documents-container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Маленькие мобильные */
@media (max-width: 640px) {
    .documents-container {
        padding-left: 16px;
        padding-right: 16px;
    }
}



/* ============================================
   АДАПТАЦИЯ ЗАГОЛОВОЧНОГО БЛОКА
   ============================================ */

.documents-header-block {
    position: relative;
    isolation: isolate;
}

.documents-title {
    position: relative;
    z-index: 10;
}

.documents-header-vector {
    opacity: 0.8;
    z-index: 0;
}

/* Адаптация заголовочного блока для планшетов */
@media (max-width: 1024px) {
    .documents-header-block {
        height: 200px !important;
    }
    
    .documents-title {
        font-size: 30px !important;
    }
    
    .documents-header-vector {
        width: 1200px !important;
        height: 300px;
    }
}

/* Адаптация для планшетов портрет */
@media (max-width: 768px) {
    .documents-header-block {
        height: 180px !important;
        border-radius: 16px !important;
        padding: 20px 16px !important;
    }
    
    .documents-title {
        font-size: 26px !important;
    }
    
    .documents-header-vector {
        width: 1000px !important;
        height: 250px;
    }
}

/* Адаптация для мобильных */
@media (max-width: 640px) {
    .documents-header-block {
        height: 150px !important;
        border-radius: 15px !important;
        padding: 20px 16px !important;
    }
    
    .documents-title {
        font-size: 24px !important;
    }
    
    .documents-header-vector {
        width: 800px !important;
        height: 200px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .documents-header-block {
        height: 130px !important;
        border-radius: 12px !important;
        padding: 16px 12px !important;
    }
    
    .documents-title {
        font-size: 22px !important;
    }
    
    .documents-header-vector {
        width: 600px !important;
        height: 180px;
        opacity: 0.5;
    }
}

/* ============================================
   АДАПТАЦИЯ СЕТКИ ДОКУМЕНТОВ
   ============================================ */

.documents-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

/* Планшеты - 2 колонки */
@media (max-width: 1280px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

/* Средние планшеты - 2 колонки с меньшим gap */
@media (max-width: 1024px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Маленькие планшеты - 1 колонка */
@media (max-width: 768px) {
    .documents-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Мобильные устройства */
@media (max-width: 640px) {
    .documents-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .documents-grid {
        gap: 10px;
    }
}

/* ============================================
   АДАПТАЦИЯ КАРТОЧЕК ДОКУМЕНТОВ
   ============================================ */

.document-card {
    transition: all 0.3s ease;
}

.document-card:hover {
    transform: translateY(-2px);
}

.document-card:active {
    transform: translateY(0);
}

/* Адаптация размеров карточек для планшетов */
@media (max-width: 1024px) {
    .document-card {
        padding: 18px !important;
        gap: 18px !important;
        min-height: 175px !important;
        border-radius: 18px !important;
    }
}

/* Адаптация для средних планшетов */
@media (max-width: 768px) {
    .document-card {
        padding: 16px !important;
        gap: 16px !important;
        min-height: 160px !important;
        border-radius: 16px !important;
    }
    
    /* Адаптация иконки документа */
    .document-card .relative.w-\[46px\] {
        width: 40px !important;
        height: 40px !important;
    }
    
    .document-card .bg-dark {
        width: 26px !important;
        height: 26px !important;
        border-radius: 8px !important;
    }
    
    .document-card .absolute.left-1\.5 {
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
    }
    
    .document-card svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Адаптация текста */
    .document-card .font-semibold.text-\[13px\] {
        font-size: 12px !important;
    }
    
    .document-card .font-bold.text-\[18px\] {
        font-size: 17px !important;
    }
    
    .document-card .flex-col.gap-\[6px\] {
        gap: 5px !important;
    }
}

/* Адаптация для мобильных */
@media (max-width: 640px) {
    .document-card {
        padding: 14px !important;
        gap: 14px !important;
        min-height: 145px !important;
        border-radius: 14px !important;
    }
    
    /* Адаптация иконки */
    .document-card .relative.w-\[46px\] {
        width: 38px !important;
        height: 38px !important;
    }
    
    .document-card .bg-dark {
        width: 24px !important;
        height: 24px !important;
    }
    
    .document-card .absolute.left-1\.5 {
        width: 28px !important;
        height: 28px !important;
        left: 5px !important;
        top: 5px !important;
    }
    
    .document-card svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* Адаптация текста */
    .document-card .font-semibold.text-\[13px\] {
        font-size: 11px !important;
        line-height: 1.3 !important;
    }
    
    .document-card .font-bold.text-\[18px\] {
        font-size: 16px !important;
        line-height: 1.2 !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .document-card {
        padding: 12px !important;
        gap: 12px !important;
        min-height: 135px !important;
        border-radius: 12px !important;
    }
    
    /* Иконка еще меньше */
    .document-card .relative.w-\[46px\] {
        width: 36px !important;
        height: 36px !important;
    }
    
    .document-card .bg-dark {
        width: 22px !important;
        height: 22px !important;
    }
    
    .document-card .absolute.left-1\.5 {
        width: 26px !important;
        height: 26px !important;
    }
    
    .document-card svg {
        width: 15px !important;
        height: 15px !important;
    }
    
    /* Текст компактнее */
    .document-card .font-semibold.text-\[13px\] {
        font-size: 10.5px !important;
    }
    
    .document-card .font-bold.text-\[18px\] {
        font-size: 15px !important;
    }
    
    .document-card .flex-col.gap-\[6px\] {
        gap: 4px !important;
    }
}

/* ============================================
   АДАПТАЦИЯ МОДАЛЬНОГО ОКНА
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

body.modal-open {
    overflow: hidden;
}

/* Адаптация модального окна для планшетов */
@media (max-width: 1024px) {
    .modal-overlay {
        padding: 16px;
    }
    
    .modal-content {
        max-width: 480px !important;
    }
}

/* Адаптация для средних планшетов */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 14px;
        align-items: flex-start;
        padding-top: 60px;
    }
    
    .modal-content {
        max-width: 100% !important;
        width: 100%;
        border-radius: 18px !important;
    }
    
    /* Шапка модалки */
    .modal-content > div:first-child {
        padding: 18px !important;
        gap: 12px !important;
    }
    
    .modal-content .font-bold.text-\[20px\] {
        font-size: 18px !important;
    }
    
    .modal-content .font-semibold.text-\[14px\] {
        font-size: 13px !important;
    }
    
    /* Кнопка закрытия */
    .modal-content button {
        padding: 10px !important;
        border-radius: 8px !important;
    }
    
    .modal-content button svg {
        width: 14px !important;
        height: 14px !important;
    }
    
    /* Контент модалки */
    .modal-content > div:last-child {
        padding: 18px !important;
        gap: 12px !important;
    }
}

/* Адаптация для мобильных */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 12px;
        padding-top: 50px;
    }
    
    .modal-content {
        border-radius: 16px !important;
        max-height: 85vh;
    }
    
    /* Шапка модалки */
    .modal-content > div:first-child {
        padding: 16px !important;
        gap: 10px !important;
    }
    
    .modal-content .font-bold.text-\[20px\] {
        font-size: 17px !important;
    }
    
    .modal-content .font-semibold.text-\[14px\] {
        font-size: 12px !important;
    }
    
    .modal-content .flex-col.gap-4 {
        gap: 12px !important;
    }
    
    /* Кнопка закрытия */
    .modal-content button {
        padding: 9px !important;
        border-radius: 8px !important;
    }
    
    .modal-content button svg {
        width: 13px !important;
        height: 13px !important;
    }
    
    /* Контент модалки */
    .modal-content > div:last-child {
        padding: 16px !important;
        gap: 10px !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 10px;
        padding-top: 40px;
    }
    
    .modal-content {
        border-radius: 14px !important;
        max-height: 88vh;
    }
    
    /* Шапка модалки */
    .modal-content > div:first-child {
        padding: 14px !important;
        gap: 8px !important;
    }
    
    .modal-content .font-bold.text-\[20px\] {
        font-size: 16px !important;
    }
    
    .modal-content .font-semibold.text-\[14px\] {
        font-size: 11px !important;
        line-height: 1.3 !important;
    }
    
    .modal-content .flex-col.gap-4 {
        gap: 10px !important;
    }
    
    /* Контент модалки */
    .modal-content > div:last-child {
        padding: 14px !important;
        gap: 8px !important;
    }
}

/* ============================================
   АДАПТАЦИЯ КАРТОЧЕК ВНУТРИ МОДАЛКИ
   ============================================ */

/* Планшеты */
@media (max-width: 1024px) {
    .modal-content .bg-white.border {
        padding: 18px !important;
        gap: 18px !important;
        min-height: 175px !important;
        border-radius: 18px !important;
    }
}

/* Средние планшеты */
@media (max-width: 768px) {
    .modal-content .bg-white.border {
        padding: 16px !important;
        gap: 16px !important;
        min-height: 165px !important;
        border-radius: 16px !important;
    }
    
    /* Иконка */
    .modal-content .relative.w-\[46px\] {
        width: 40px !important;
        height: 40px !important;
    }
    
    .modal-content .bg-primary {
        width: 26px !important;
        height: 26px !important;
        border-radius: 8px !important;
    }
    
    .modal-content .absolute.left-1\.5 {
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
    }
    
    .modal-content svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Текст внутри карточек модалки */
    .modal-content .font-bold.text-base {
        font-size: 15px !important;
    }
    
    .modal-content .bg-white .font-semibold.text-\[14px\] {
        font-size: 13px !important;
    }
    
    .modal-content .flex-col.gap-2\.5 {
        gap: 8px !important;
    }
}

/* Мобильные */
@media (max-width: 640px) {
    .modal-content .bg-white.border {
        padding: 14px !important;
        gap: 14px !important;
        min-height: 150px !important;
        border-radius: 14px !important;
    }
    
    /* Иконка */
    .modal-content .relative.w-\[46px\] {
        width: 36px !important;
        height: 36px !important;
    }
    
    .modal-content .bg-primary {
        width: 24px !important;
        height: 24px !important;
    }
    
    .modal-content .absolute.left-1\.5 {
        width: 28px !important;
        height: 28px !important;
        left: 4px !important;
        top: 4px !important;
    }
    
    .modal-content svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* Текст */
    .modal-content .font-bold.text-base {
        font-size: 14px !important;
    }
    
    .modal-content .bg-white .font-semibold.text-\[14px\] {
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .modal-content .bg-white.border {
        padding: 12px !important;
        gap: 12px !important;
        min-height: 140px !important;
        border-radius: 12px !important;
    }
    
    /* Иконка */
    .modal-content .relative.w-\[46px\] {
        width: 34px !important;
        height: 34px !important;
    }
    
    .modal-content .bg-primary {
        width: 22px !important;
        height: 22px !important;
    }
    
    .modal-content .absolute.left-1\.5 {
        width: 26px !important;
        height: 26px !important;
    }
    
    .modal-content svg {
        width: 15px !important;
        height: 15px !important;
    }
    
    /* Текст */
    .modal-content .font-bold.text-base {
        font-size: 13px !important;
    }
    
    .modal-content .bg-white .font-semibold.text-\[14px\] {
        font-size: 11px !important;
    }
    
    .modal-content .flex-col.gap-2\.5 {
        gap: 6px !important;
    }
}

/* ============================================
   ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ
   ============================================ */

/* Улучшения для средних экранов (планшеты в портретной ориентации) */
@media (min-width: 641px) and (max-width: 768px) {
    .documents-container {
        padding-left: 30px;
        padding-right: 30px;
    }
}

/* Предотвращение горизонтального скролла */
body {
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Плавные переходы для изображений */
img {
    transition: opacity 0.3s ease-in-out;
}

/* Улучшение отображения на экранах с высокой плотностью пикселей */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Отключение hover эффектов на тач-устройствах */
@media (hover: none) and (pointer: coarse) {
    .document-card:hover {
        transform: none;
    }
    
    .mobile-menu .menu-item:hover {
        background: transparent;
    }
    
    .mobile-menu .menu-item:hover p {
        color: inherit;
        transform: none;
    }
}

/* Улучшенная прокрутка на мобильных */
@media (max-width: 768px) {
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* Адаптация отступов секций */
@media (max-width: 768px) {
    section.py-4 {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
    }
}

@media (max-width: 640px) {
    section.py-4 {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
}

@media (max-width: 480px) {
    section.py-4 {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}
