/* static/css/utils/responsive.css */
/* Все медиа-запросы проекта в одном месте */

/* ===== БОЛЬШИЕ ЭКРАНЫ (ДЕСКТОП) ===== */
@media (max-width: 1400px) {
    .container {
        max-width: 1200px;
    }
}

@media (max-width: 1200px) {
    :root {
        --spacing-xl: 28px;
        --spacing-lg: 20px;
    }
    
    .container {
        max-width: 960px;
    }
    
    /* Хедер */
    .header {
        padding: 0 20px;
    }
    
    .form-search {
        width: 350px;
    }
}

/* ===== ПЛАНШЕТЫ ===== */
@media (max-width: 992px) {
    :root {
        --spacing-xl: 24px;
        --spacing-lg: 18px;
        --header-height: auto;
        --card-image-height: 180px;
    }
    
    .container {
        max-width: 720px;
        margin-top: 3%;
    }
    
    /* Хедер */
    .header-top {
        flex-wrap: wrap;
        height: auto;
        gap: var(--spacing-md);
        padding: var(--spacing-md) 0;
    }
    
    .header-bottom {
        flex-wrap: wrap;
        height: auto;
        gap: var(--spacing-md);
        padding: var(--spacing-sm) 0;
    }
    
    .form-search {
        width: 250px;
    }
    
    .header-nav {
        gap: var(--spacing-md);
    }
    
    /* Профиль */
    .profile-wrapper {
        flex-wrap: wrap;
    }
    
    .profile-sidebar {
        width: 100%;
        order: 1;
        margin-bottom: var(--spacing-md);
        display: flex;
        gap: var(--spacing-md);
    }
    
    .profile-sidebar .avatar-card {
        flex: 1;
    }
    
    .profile-sidebar .stats-card {
        flex: 1;
        margin-top: 0 !important;
    }
    
    .profile-content {
        order: 3;
        width: 100%;
    }
    
    .profile-actions {
        width: 100%;
        order: 2;
        margin-bottom: var(--spacing-md);
    }
    
    .profile-actions .actions-card {
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .actions-head {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .action-link {
        flex: 1;
        min-width: 120px;
    }
    
    /* Баланс */
    .balance-wrapper {
        flex-wrap: wrap;
    }
    
    .balance-stats {
        width: 100%;
        order: 1;
        margin-bottom: var(--spacing-md);
    }
    
    .balance-history {
        order: 3;
        width: 100%;
    }
    
    .balance-info {
        width: 100%;
        order: 2;
        margin-bottom: var(--spacing-md);
    }
    
    /* Калькулятор */
    .calculator-wrapper {
        flex-wrap: wrap;
    }
    
    .calculator-input-sidebar {
        width: 100%;
        order: 1;
        margin-bottom: var(--spacing-md);
    }
    
    .calculator-result {
        margin-top: var(--spacing-md);
    }
    
    .calculator-info-sidebar {
        width: 100%;
        order: 2;
        margin-bottom: var(--spacing-md);
        display: flex;
        gap: var(--spacing-md);
        flex-wrap: wrap;
    }
    
    .calculator-info-sidebar .info-card {
        flex: 1;
        min-width: 200px;
    }
}

/* ===== МОБИЛЬНЫЕ УСТРОЙСТВА ===== */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 20px;
        --spacing-lg: 16px;
        --spacing-md: 12px;
        --font-size-base: 13px;
        --font-size-md: 14px;
        --card-image-height: 160px;
        --thumbnail-size: 60px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 var(--spacing-md);
        margin-top: 2%;
    }
    
    /* Хедер */
    .header {
        padding: 0 10px;
    }
    
    .header-top {
        flex-direction: column;
        text-align: center;
    }
    
    .header-bottom {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .form-search {
        width: 200px;
    }
    
    .search-button {
        padding: var(--spacing-sm) 12px;
    }
    
    .header-nav {
        justify-content: center;
    }
    
    /* Поднавигация */
    .sub-nav {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .sub-nav-link {
        padding: var(--spacing-xs) 12px;
        font-size: var(--font-size-sm);
    }
    
    /* Сайдбары */
    .left-sidebar,
    .right-sidebar {
        padding: var(--spacing-md);
    }
    
    .categories-sidebar {
        margin-bottom: var(--spacing-md);
    }
    
    .categories-tree .children {
        margin-left: 12px;
        padding-left: 8px;
    }
    
    .category-link {
        padding: var(--spacing-xs) var(--spacing-md);
        font-size: var(--font-size-sm);
    }
    
    .filters-sidebar {
        padding: var(--spacing-md);
    }
    
    .price-range {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .dimension-filter {
        margin-bottom: var(--spacing-md);
    }
    
    /* Карточки */
    .card-image-wrapper {
        height: 160px;
    }
    
    .card-title .fw-normal {
        font-size: var(--font-size-xs);
    }
    
    .draw-name {
        font-size: var(--font-size-sm);
    }
    
    .price-value {
        font-size: var(--font-size-sm);
    }
    
    /* Детальная страница */
    .product-gallery {
        position: relative;
        top: 0;
        margin-bottom: var(--spacing-lg);
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .add-image-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .list-group-item {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    /* Корзина */
    .cart-table th,
    .cart-table td {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
    
    .quantity-input {
        width: 60px;
        font-size: var(--font-size-sm);
    }
    
    .summary-card {
        width: 100%;
    }
    
    .cart-summary {
        justify-content: center;
    }
    
    /* Заказы */
    .order-card-header {
        flex-direction: column;
        text-align: center;
    }
    
    .order-items-table th,
    .order-items-table td {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
    
    .order-items-table {
        min-width: 500px;
    }
    
    .orders-header {
        flex-direction: column;
        text-align: center;
    }
    
    /* Профиль */
    .profile-sidebar {
        flex-direction: column;
    }
    
    .info-row {
        flex-direction: column;
    }
    
    .info-label {
        width: 100%;
        margin-bottom: var(--spacing-xs);
    }
    
    .address-block h6 {
        margin-bottom: var(--spacing-xs);
    }
    
    .address-actions-row {
        margin-top: var(--spacing-sm);
        justify-content: flex-end;
    }
    
    .phone-step .d-flex,
    .password-step .d-flex {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .change-btn {
        width: 100%;
    }
    
    .current-phone {
        margin-bottom: var(--spacing-xs);
    }
    
    /* Баланс */
    .history-table {
        font-size: var(--font-size-xs);
    }
    
    .history-table th,
    .history-table td {
        padding: var(--spacing-xs);
    }
    
    .btn-receipt {
        padding: 2px 6px;
        font-size: 0.625rem;
    }
    
    .stats-amount {
        font-size: 24px;
    }
    
    /* Калькулятор */
    .calculator-info-sidebar {
        flex-direction: column;
    }
    
    .calculator-info-sidebar .info-card {
        flex: none;
        width: 100%;
    }
    
    .result-header {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }
    
    .download-result-btn {
        justify-content: center;
    }
    
    .history-profile-line,
    .history-stats-line {
        font-size: var(--font-size-xs);
        padding-right: 20px;
    }
    
    .history-delete {
        bottom: var(--spacing-sm);
        right: var(--spacing-sm);
        font-size: var(--font-size-sm);
        padding: var(--spacing-xs);
    }
    
    /* Пагинация */
    .pagination .page-link {
        min-width: 32px;
        height: 32px;
        padding: 0 var(--spacing-xs);
        font-size: var(--font-size-sm);
    }
    
    .pagination-container {
        margin-top: var(--spacing-lg);
    }
    
    /* Общие утилиты */
    .hide-on-mobile {
        display: none !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ ===== */
@media (max-width: 576px) {
    :root {
        --spacing-xl: 16px;
        --spacing-lg: 14px;
        --spacing-md: 10px;
        --font-size-base: 12px;
        --card-image-height: 140px;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .cart-table {
        min-width: 500px;
    }
    
    .cart-header h1 {
        font-size: var(--font-size-lg);
    }
    
    .orders-header h1 {
        font-size: var(--font-size-lg);
    }
    
    .download-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-xs);
    }
    
    .product-type-badge {
        font-size: 0.625rem;
        padding: 2px 6px;
    }
    
    .pagination {
        gap: var(--spacing-xs);
    }
    
    .pagination .page-link {
        min-width: 28px;
        height: 28px;
        font-size: var(--font-size-xs);
    }
    
    /* Скрываем номера страниц, кроме текущей и соседних */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):nth-child(n+4):nth-last-child(n+4) {
        display: none;
    }
    
    .hide-on-phone {
        display: none !important;
    }
    
    /* Увеличение кликабельных областей */
    .btn, 
    .category-link,
    .sub-nav-link {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }
}

/* ===== HOVER ЭФФЕКТЫ ТОЛЬКО ДЛЯ УСТРОЙСТВ С МЫШЬЮ ===== */
@media (hover: hover) {
    .btn:hover,
    .category-link:hover,
    .product-card:hover {
        transition: all var(--transition-base);
    }
}

/* ===== ОТКЛЮЧАЕМ HOVER НА ТАЧ-УСТРОЙСТВАХ ===== */
@media (hover: none) {
    .btn:hover,
    .category-link:hover {
        transform: none;
    }
}

/* ===== АДАПТИВНЫЕ ТАБЛИЦЫ ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== АДАПТИВНЫЕ ИЗОБРАЖЕНИЯ ===== */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* ===== АДАПТИВНЫЕ ВИДЕО ===== */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}