/* ================================================================
   RESPONSIVE.CSS - Giao diện tương thích đa thiết bị
   Breakpoints:
   - Tablet: max-width 1024px
   - Mobile: max-width 768px
   - Small: max-width 480px
   ================================================================ */

/* ===== TABLET (≤ 1024px) ===== */
@media (max-width: 1024px) {
    /* Features grid: 2 cột */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats grid: 2 cột */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Dashboard stats: 2 cột */
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Dashboard grid: 1 cột */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Admin sidebar: ẩn trên tablet, hiện khi toggle */
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-content-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    /* Footer: 2 cột */
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    /* Form row: 1 cột */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Detail grid: 1 cột */
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== MOBILE (≤ 768px) ===== */
@media (max-width: 768px) {
    /* Header */
    .mobile-menu-toggle {
        display: block;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 100;
        overflow-y: auto;
    }

    .main-nav.active {
        transform: translateX(0);
    }

    .nav-link {
        padding: 12px 16px;
        width: 100%;
    }

    .nav-group {
        flex-direction: column;
        width: 100%;
    }

    .nav-auth {
        margin-left: 0;
        width: 100%;
    }

    .nav-auth .btn-login {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .user-menu {
        margin-left: 0;
        width: 100%;
    }

    .user-menu-btn {
        width: 100%;
        justify-content: center;
    }

    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        margin-top: 8px;
        display: none;
    }

    .user-menu.active .user-dropdown {
        display: block;
    }

    /* Hero section */
    .hero-section {
        padding: 50px 20px;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    /* Features: 1 cột */
    .features-grid {
        grid-template-columns: 1fr;
    }

    /* Stats: 1 cột */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* How to: vertical */
    .howto-steps {
        flex-direction: column;
    }

    .howto-connector {
        transform: rotate(90deg);
    }

    /* Login card */
    .login-card {
        padding: 24px;
    }

    /* Stats cards: 1 cột */
    .stats-cards {
        grid-template-columns: 1fr;
    }

    /* Admin header */
    .admin-search {
        max-width: 200px;
    }

    .header-datetime {
        display: none;
    }

    /* Admin main */
    .admin-main {
        padding: 16px;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
    }

    /* Table toolbar */
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar-left,
    .table-toolbar-right {
        flex-direction: column;
    }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ===== SMALL MOBILE (≤ 480px) ===== */
@media (max-width: 480px) {
    /* Typography */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    /* Login */
    .login-container {
        padding: 20px 12px;
    }

    .login-card {
        padding: 20px;
        border-radius: var(--border-radius-lg);
    }

    .login-icon {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    /* Admin header */
    .admin-search {
        display: none;
    }

    .header-user-btn span {
        display: none;
    }

    /* Buttons */
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Cards */
    .stat-card {
        padding: 16px;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    /* Tables: scroll */
    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }

    /* Pagination */
    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }

    /* Error actions */
    .error-actions {
        flex-direction: column;
    }

    .error-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Form actions */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal */
    .modal {
        padding: 20px;
        width: 95%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== PRINT ===== */
@media print {
    .admin-sidebar,
    .admin-header,
    .sidebar-overlay,
    .client-header,
    .client-footer,
    .btn,
    .filter-bar,
    .table-toolbar,
    .pagination {
        display: none !important;
    }

    .admin-content-wrapper {
        margin-left: 0 !important;
    }

    .admin-main {
        padding: 0 !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .data-table {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}
