/**
 * ============================================
 * AMANAH EXCHANGE - Responsive System
 * Полная адаптация для всех устройств
 * ============================================
 */

/* ===== БРЕЙКПОИНТЫ ===== */
/*
 * Desktop XL:   1920px+
 * Desktop L:    1440px - 1919px
 * Desktop:      1024px - 1439px
 * Tablet:       768px - 1023px
 * Mobile L:     480px - 767px
 * Mobile:       320px - 479px
 */

/* ============================================
 * DESKTOP LARGE (1440px+)
 * ============================================ */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
 * DESKTOP (1024px - 1439px)
 * ============================================ */
@media (max-width: 1439px) {
    .container {
        max-width: 1200px;
        padding: 0 2rem;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 1200px) {
    /* Таблицы */
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 1000px;
    }
    
    /* Сетки */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wallets-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
 * TABLET (768px - 1023px)
 * ============================================ */
@media (max-width: 1024px) {
    html {
        font-size: 15px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }
    
    /* Hero Section */
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-cta {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--color-dark);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex !important;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Steps */
    .steps-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .step-connector {
        display: none;
    }
    
    /* Footer */
    .footer-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Admin Sidebar */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    /* Filters Panel */
    .filters-panel {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
}

/* ============================================
 * MOBILE LARGE (480px - 767px)
 * ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    /* Typography */
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    /* Hero */
    .hero {
        min-height: auto;
        padding: 6rem 0 4rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    /* Navigation */
    .nav-actions {
        display: none;
    }
    
    .nav-brand {
        font-size: 1.5rem;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Wallets Grid */
    .wallets-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Cards */
    .feature-card,
    .stat-card,
    .trade-card {
        padding: 1.5rem;
    }
    
    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 800px;
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Modals */
    .modal-dialog {
        width: 95%;
        max-width: 95%;
        margin: 1rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    /* Section Headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .section-actions {
        width: 100%;
        flex-direction: column;
    }
    
    /* Filters */
    .filters-panel {
        padding: 1rem;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .pagination button {
        min-width: 40px;
        padding: 0.5rem;
    }
    
    /* Footer */
    .footer-top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Calculator */
    .calculator-form {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* FAQ */
    .faq-item {
        padding: 1.5rem;
    }
    
    /* Dashboard Charts */
    canvas {
        max-height: 250px !important;
    }
    
    /* Trade Details */
    .trade-details-grid {
        grid-template-columns: 1fr;
    }
    
    /* KYC Documents */
    .documents-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
 * MOBILE (320px - 479px)
 * ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    /* Typography */
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Hero */
    .hero {
        padding: 4rem 0 3rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .btn i {
        font-size: 1rem;
    }
    
    /* Cards */
    .feature-card,
    .stat-card,
    .trade-card {
        padding: 1.25rem;
    }
    
    /* Stats */
    .stat-number {
        font-size: 2rem;
    }
    
    /* Modals */
    .modal-dialog {
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
    
    /* Tables */
    .data-table {
        min-width: 700px;
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Forms */
    input,
    select,
    textarea {
        font-size: 1rem;
    }
    
    label {
        font-size: 0.9rem;
    }
    
    /* Navigation */
    .navbar {
        height: 60px;
        padding: 0 0.75rem;
    }
    
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        top: 60px;
        height: calc(100vh - 60px);
        padding: 1.5rem;
    }
    
    /* Section Spacing */
    section {
        padding: 3rem 0;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-column h4 {
        font-size: 1.1rem;
    }
    
    /* Badge */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Notifications */
    .notification {
        width: calc(100% - 1.5rem);
        margin: 0.75rem;
    }
}

/* ============================================
 * LANDSCAPE ORIENTATION
 * ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 3rem 0 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .nav-menu {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

/* ============================================
 * HIGH DPI DISPLAYS (Retina)
 * ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .btn {
        -webkit-font-smoothing: antialiased;
    }
}

/* ============================================
 * PRINT STYLES
 * ============================================ */
@media print {
    .navbar,
    .footer,
    .btn,
    .nav-toggle,
    .scroll-top,
    .filters-panel,
    .section-actions {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
    }
    
    .data-table {
        font-size: 10pt;
    }
    
    .modal-dialog {
        width: 100%;
        max-width: 100%;
    }
}

/* ============================================
 * TOUCH DEVICES
 * ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Увеличенные touch targets */
    .btn,
    .nav-link,
    .pagination button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Убираем hover эффекты на touch устройствах */
    .feature-card:hover,
    .stat-card:hover,
    .btn:hover {
        transform: none;
    }
}

/* ============================================
 * REDUCED MOTION
 * ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
 * DARK MODE (System Preference)
 * ============================================ */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

/* ============================================
 * LIGHT MODE (System Preference)
 * ============================================ */
@media (prefers-color-scheme: light) {
    /* Optional: Add light mode overrides */
    /* Currently not implemented */
}
