/* ============================================================
   RESPONSIVE.CSS - Quốc Anh Store
   Dùng chung cho TẤT CẢ các trang user/
   ============================================================ */

/* ===== TABLET & MOBILE BASE ===== */
@media (max-width: 992px) {
    .container {
        padding: 0 16px !important;
    }
}

/* ===== MOBILE (≤ 768px) ===== */
@media (max-width: 768px) {
    
    /* ===== HEADER ===== */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    .header-top {
        padding: 4px 0 !important;
        font-size: 10px !important;
    }
    
    .header-top .container {
        flex-direction: column !important;
        gap: 2px !important;
        text-align: center !important;
    }
    
    .header-top .left span {
        margin-right: 10px !important;
        font-size: 10px !important;
    }
    
    .header-top .right a {
        margin-left: 10px !important;
        font-size: 10px !important;
    }
    
    .header-main {
        padding: 10px 0 !important;
    }
    
    .header-main .container {
        flex-wrap: wrap !important;
        gap: 10px !important;
        justify-content: space-between !important;
    }
    
    .logo {
        gap: 8px !important;
    }
    
    .logo-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
    
    .logo h1 {
        font-size: 16px !important;
        letter-spacing: 0.5px !important;
    }
    
    .logo .slogan {
        font-size: 8px !important;
        letter-spacing: 2px !important;
    }
    
    /* ===== SEARCH ===== */
    .search-group,
    .search-bar-wrap {
        order: 3 !important;
        max-width: 100% !important;
        width: 100% !important;
        flex-basis: 100% !important;
        margin-top: 8px !important;
    }
    
    .search-bar input {
        padding: 9px 16px !important;
        font-size: 13px !important;
        height: 40px !important;
    }
    
    .search-bar button {
        padding: 9px 18px !important;
        height: 40px !important;
        font-size: 14px !important;
    }
    
    .btn-categories {
        padding: 0 14px !important;
        font-size: 13px !important;
        height: 40px !important;
    }
    
    .btn-categories span {
        display: none !important;
    }
    
    .btn-categories .arrow {
        display: none !important;
    }
    
    /* ===== HEADER ACTIONS ===== */
    .header-actions {
        gap: 8px !important;
    }
    
    .header-actions .action-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 15px !important;
    }
    
    .header-actions .cart-badge {
        min-width: 16px !important;
        height: 16px !important;
        font-size: 9px !important;
    }
    
    /* ===== NAV USER ===== */
    .nav-user {
        position: sticky !important;
        top: 0 !important;
        z-index: 998 !important;
    }
    
    .nav-user .container {
        padding: 8px 0 !important;
        gap: 2px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    
    .nav-user .container::-webkit-scrollbar {
        display: none !important;
    }
    
    .nav-user a {
        padding: 7px 14px !important;
        font-size: 12px !important;
        letter-spacing: 0 !important;
    }
    
    .nav-user a i {
        margin-right: 5px !important;
        font-size: 12px !important;
    }
    
    /* ===== MAIN CONTENT ===== */
    .main-content {
        margin-top: 200px !important;
        padding: 20px 0 40px !important;
    }
    
    /* Nếu không có dashboard */
    .main-content.no-dashboard {
        margin-top: 160px !important;
    }
    
    /* ===== PAGE HEADER ===== */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }
    
    .page-header h1 {
        font-size: 22px !important;
    }
    
    /* ===== CARDS & TABLES ===== */
    .card {
        padding: 16px !important;
        border-radius: 10px !important;
    }
    
    .cart-layout,
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .summary-card {
        position: static !important;
        top: auto !important;
    }
    
    /* ===== CART TABLE → CARD VIEW ===== */
    .cart-table thead {
        display: none !important;
    }
    
    .cart-table,
    .cart-table tbody,
    .cart-table tr,
    .cart-table td {
        display: block !important;
        width: 100% !important;
    }
    
    .cart-table tr {
        background: #fff !important;
        border: 1px solid #d4e8ff !important;
        border-radius: 10px !important;
        margin-bottom: 12px !important;
        padding: 12px !important;
    }
    
    .cart-table td {
        padding: 8px 0 !important;
        border-bottom: 1px dashed #e8f2ff !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .cart-table td:last-child {
        border-bottom: none !important;
    }
    
    .cart-table td::before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        color: #6a5f55 !important;
        font-size: 12px !important;
        text-transform: uppercase !important;
    }
    
    .product-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    .product-thumb {
        width: 60px !important;
        height: 60px !important;
    }
    
    /* ===== PRODUCT GRID ===== */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .product-card .img {
        height: 160px !important;
        min-height: 160px !important;
    }
    
    .product-card .body {
        padding: 10px 12px 8px !important;
    }
    
    .product-card .body h3 {
        font-size: 13px !important;
        min-height: 36px !important;
        max-height: 36px !important;
    }
    
    .product-card .body .price {
        font-size: 15px !important;
    }
    
    .product-card .footer {
        padding: 8px 12px 10px !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
    
    .product-card .footer .add-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
    }
    
    /* ===== FLASH SALE ===== */
    .flash-card {
        flex: 0 0 70% !important;
        min-width: 160px !important;
    }
    
    .flash-card .flash-image {
        height: 140px !important;
    }
    
    .flash-sale-header {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        justify-items: center !important;
        text-align: center !important;
    }
    
    .flash-sale-tabs {
        justify-content: center !important;
    }
    
    .flash-countdown {
        justify-content: center !important;
    }
    
    /* ===== CATEGORY MENU ===== */
    .category-menu {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        padding: 14px 10px !important;
    }
    
    .cat-menu-item .cat-icon {
        width: 40px !important;
        height: 40px !important;
    }
    
    .cat-menu-item .cat-name {
        font-size: 10px !important;
        min-height: 26px !important;
    }
    
    /* ===== STEPPER ===== */
    .checkout-stepper {
        padding: 16px 12px !important;
    }
    
    .checkout-stepper h2 {
        font-size: 18px !important;
        margin-bottom: 16px !important;
    }
    
    .stepper-list {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .step-line {
        display: none !important;
    }
    
    .step-item {
        max-width: 100% !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        gap: 12px !important;
    }
    
    .step-circle {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
        flex-shrink: 0 !important;
    }
    
    .step-label {
        text-align: left !important;
        font-size: 13px !important;
    }
    
    /* ===== ORDER STEPPER ===== */
    .order-step-circle {
        width: 36px !important;
        height: 36px !important;
        font-size: 13px !important;
    }
    
    .order-step-label {
        font-size: 10px !important;
    }
    
    .order-step-line {
        top: 17px !important;
    }
    
    /* ===== FORMS ===== */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 15px !important; /* Tránh zoom trên iOS */
        padding: 10px 12px !important;
    }
    
    /* ===== COMPARE TABLE ===== */
    .compare-table th {
        width: 100px !important;
        font-size: 11px !important;
        padding: 8px 6px !important;
    }
    
    .compare-table td {
        font-size: 12px !important;
        padding: 8px 6px !important;
    }
    
    .product-col-head {
        padding: 12px 6px !important;
    }
    
    .product-col-head .img {
        width: 70px !important;
        height: 70px !important;
    }
    
    .product-col-head h3 {
        font-size: 11px !important;
        min-height: 42px !important;
        max-height: 42px !important;
    }
    
    .product-col-head .price {
        font-size: 13px !important;
    }
    
    /* ===== VOUCHER ===== */
    .voucher-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .voucher-card {
        flex-direction: column !important;
    }
    
    .voucher-left {
        flex: 0 0 auto !important;
        padding: 14px !important;
    }
    
    .voucher-card::before,
    .voucher-card::after {
        display: none !important;
    }
    
    .voucher-right {
        border-left: none !important;
        border-top: 2px dashed #e8e0d8 !important;
        padding: 14px !important;
    }
    
    /* ===== TABS ===== */
    .tabs {
        flex-direction: column !important;
        border-radius: 10px !important;
    }
    
    .tab {
        border-radius: 8px !important;
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    /* ===== BOTTOM ACTION BAR ===== */
    .bottom-action-bar {
        padding: 10px 14px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .bottom-action-bar .info {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .bottom-action-bar .actions {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .btn-apply,
    .btn-cancel {
        flex: 1 !important;
        justify-content: center !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    
    /* ===== FOOTER ===== */
    .footer {
        padding: 32px 0 20px !important;
        margin-top: 30px !important;
    }
    
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .footer h4 {
        font-size: 15px !important;
        margin-bottom: 10px !important;
    }
    
    .footer p,
    .footer a {
        font-size: 13px !important;
    }
    
    /* ===== AI CHAT ===== */
    .ai-chat-box {
        right: 10px !important;
        bottom: 80px !important;
        width: calc(100vw - 20px) !important;
        height: 70vh !important;
    }
    
    .ai-chat-button {
        right: 12px !important;
        bottom: 12px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 18px !important;
    }
    
    /* ===== MODAL ===== */
    .modal {
        max-width: calc(100vw - 24px) !important;
        margin: 12px !important;
    }
    
    .modal-header {
        padding: 14px 16px !important;
    }
    
    .modal-body {
        padding: 16px !important;
    }
    
    .modal-footer {
        padding: 12px 16px !important;
    }
    
    /* ===== EMPTY STATE ===== */
    .empty-state {
        padding: 40px 16px !important;
    }
    
    .empty-state i {
        font-size: 48px !important;
    }
    
    .empty-state h3 {
        font-size: 17px !important;
    }
    
    /* ===== ALERT ===== */
    .alert,
    .cart-alert {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
}

/* ===== SMALL MOBILE (≤ 480px) ===== */
@media (max-width: 480px) {
    
    .container {
        padding: 0 12px !important;
    }
    
    .product-grid {
        grid-template-columns: 1fr !important;
    }
    
    .category-menu {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        padding: 10px 6px !important;
    }
    
    .cat-menu-item .cat-icon {
        width: 36px !important;
        height: 36px !important;
    }
    
    .cat-menu-item .cat-name {
        font-size: 9px !important;
    }
    
    .flash-card {
        flex: 0 0 85% !important;
        min-width: 150px !important;
    }
    
    .page-header h1 {
        font-size: 20px !important;
    }
    
    .logo h1 {
        font-size: 14px !important;
    }
    
    .logo .slogan {
        font-size: 7px !important;
    }
    
    .header-actions .action-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        margin-top: 140px !important;
    }
}

/* ===== FIX CHO iOS SAFARI ===== */
@supports (-webkit-touch-callout: none) {
    .header {
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
    
    input, select, textarea {
        font-size: 16px !important; /* Tránh zoom */
    }
}

/* ===== FIX STICKY NAV CHO MOBILE ===== */
@media (max-width: 768px) {
    .nav-user {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
    }
}