/* ============================================
   MuaKey - Global Styles
   ============================================ */

/* ── Page Transition: Top Progress Bar + Fade ── */
#page-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #1677ff, #69b1ff, #1677ff);
    background-size: 200% 100%;
    z-index: 99999;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(22, 119, 255, 0.6), 0 0 20px rgba(22, 119, 255, 0.3);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    pointer-events: none;
    animation: progressShimmer 1.5s linear infinite;
}
#page-progress.loading {
    width: 85%;
}
#page-progress.done {
    width: 100%;
    opacity: 0;
}
@keyframes progressShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dot indicator at the end of the bar */
#page-progress::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1677ff;
    box-shadow: 0 0 8px rgba(22, 119, 255, 0.8);
}

/* Page fade-in on load */
body {
    animation: pageFadeIn 0.25s ease forwards;
}
@keyframes pageFadeIn {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

/* Page fade-out on leave */
body.page-leaving {
    opacity: 0.5;
    transition: opacity 0.25s ease;
}

/* CSS Variables */
:root {
    --primary: #1677ff; /* Tech Blue */
    --primary-dark: #0958d9;
    --primary-light: #69b1ff;
    --secondary: #001529; /* Ant dark theme */
    --secondary-light: #002c8c;
    --accent: #0958d9; 
    --bg-white: #ffffff; 
    --bg-light: #f5f5f5; 
    --bg-dark: #001529;
    --text-primary: rgba(0, 0, 0, 0.88);
    --text-secondary: rgba(0, 0, 0, 0.65);
    --text-muted: rgba(0, 0, 0, 0.45);
    --success: #52c41a;
    --error: #ff4d4f;
    --warning: #faad14;
    --border: #f0f0f0;
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px 0 rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
    --glow: 0 4px 14px 0 rgba(22, 119, 255, 0.39);
    --glow-strong: 0 6px 20px rgba(22, 119, 255, 0.23);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
    color: var(--text-primary);
    background: var(--bg-light);
    line-height: 1.5715;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ============================================
   New 3-Tier Site Header
   ============================================ */
.site-header {
    background: var(--bg-white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    border-bottom: 1px solid var(--border);
}
.site-header a { text-decoration: none; color: inherit; transition: var(--transition); }

/* Top Bar */
.header-top {
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    height: 32px;
}
.header-top .container { display: flex; justify-content: space-between; align-items: center; height: 100%; }
.header-top-left { display: flex; gap: 24px; }
.header-top-left .dropdown { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.header-top-right { display: flex; gap: 24px; }
.header-top-right a { color: rgba(255,255,255,0.9); }
.header-top-right a:hover { color: #fff; }

/* Main Bar */
.header-main { padding: 16px 0; border-bottom: 1px solid var(--border); }
.header-main .container { display: flex; align-items: center; gap: 40px; }
.header-logo img { height: 40px; object-fit: contain; }

.header-search {
    flex: 1;
    display: flex;
    background: var(--bg-light);
    border-radius: var(--radius);
    height: 40px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition);
}
.header-search:focus-within {
    border-color: var(--primary);
    background: var(--bg-white);
}
.header-search input {
    border: none;
    background: transparent;
    padding: 0 16px;
    flex: 1;
    font-size: 14px;
    outline: none;
    color: var(--text-primary);
}
.header-search button {
    border: none;
    background: transparent;
    padding: 0 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}

.header-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-light);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.icon-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); box-shadow: var(--glow); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-light); }

.header-user { position: relative; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.header-user .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-info { display: flex; flex-direction: column; }
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-info .user-balance { font-size: 13px; font-weight: 600; color: var(--primary); }

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.2s;
    z-index: 100;
    border: 1px solid var(--border);
}
.header-user:hover .user-dropdown, .user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; color: var(--text-secondary); font-size: 14px;
}
.user-dropdown a:hover { background: var(--bg-light); color: var(--primary); }
.user-dropdown .dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-dropdown .logout { color: var(--error); }
.user-dropdown .logout:hover { background: var(--bg-light); color: var(--error); }


/* Nav Bar */
.header-nav { height: 48px; }
.header-nav .container { display: flex; justify-content: space-between; align-items: center; height: 100%; }
.main-nav { display: flex; gap: 32px; height: 100%; }
.main-nav a {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-secondary); font-weight: 500; font-size: 14px;
    height: 100%; position: relative;
}
.main-nav a i.fa-angle-down { font-size: 12px; opacity: 0.6; }
.main-nav a:hover, .main-nav a.active { color: var(--primary); text-shadow: var(--glow); }
.main-nav a.active::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px; background: var(--primary);
    box-shadow: var(--glow);
}

.nav-contact { display: flex; gap: 24px; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.nav-contact a { display: flex; align-items: center; gap: 8px; }
.nav-contact a:hover { color: var(--primary); text-shadow: var(--glow); }

/* Responsive Header */
@media (max-width: 991px) {
    .header-top { display: none; }
    .header-main .container { gap: 16px; flex-wrap: nowrap; justify-content: space-between; }
    .header-logo img { height: 32px; }
    .header-search { display: none; }
    .header-nav { display: none; } /* Hide entire bottom bar on mobile because of sidebar */
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
}


/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading {
    display: none;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: linear-gradient(135deg, #1677ff 0%, #001529 100%);
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg opacity="0.05" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="2" cy="2" r="2" fill="%23fff"/></svg>') repeat;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-content h1 {
    font-size: 38px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
}

.hero-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ============================================
   Products Section
   ============================================ */
.products-section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-orange {
    color: var(--primary);
}

.section-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-link:hover {
    text-decoration: underline;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-strong);
    border-color: var(--primary);
}

.product-image {
    position: relative;
    height: 140px;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
}

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.price-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.btn-buy {
    padding: 8px 16px;
    font-size: 13px;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-products i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ============================================
   Categories Section
   ============================================ */
.categories-section {
    padding: 60px 0;
    background: var(--bg-light);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    text-align: center;
    box-shadow: var(--shadow);
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--glow);
    transform: translateY(-4px);
}

.category-card i {
    font-size: 36px;
    color: var(--primary);
    transition: var(--transition);
}

.category-card:hover i {
    color: #fff;
    text-shadow: var(--glow);
}

.category-card span {
    font-size: 13px;
    font-weight: 600;
}

/* ============================================
   Features Section
   ============================================ */
.features-section {
    padding: 40px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature-item {
    text-align: center;
    padding: 24px;
}

.feature-item i {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 16px;
}

.feature-item h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-item p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-page {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="search"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--bg-white);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 79, 70, 229), 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-group input:disabled,
.form-group input[readonly] {
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-group input.input-error {
    border-color: var(--error);
}

.form-group input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.form-group input.input-success {
    border-color: var(--success);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.toggle-password:hover {
    color: var(--text-primary);
}

.field-error {
    font-size: 12px;
    color: var(--error);
    margin-top: 2px;
}

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.checkbox-label a {
    color: var(--primary);
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.forgot-link {
    color: var(--primary);
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

.auth-divider {
    text-align: center;
    position: relative;
    margin: 20px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    position: relative;
    background: #fff;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.social-login {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    padding: 10px;
    font-size: 13px;
}

.btn-google {
    background: #fff;
    border-color: var(--border);
    color: #333;
}

.btn-google:hover {
    background: #f5f5f5;
    color: #333;
}

.btn-facebook {
    background: #1877F2;
    border-color: #1877F2;
    color: #fff;
}

.btn-facebook:hover {
    background: #166FE5;
    border-color: #166FE5;
    color: #fff;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

/* ============================================
   Modals
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.4);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-product-info {
    text-align: center;
    margin-bottom: 20px;
}

.modal-product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.modal-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.modal-qty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    background: var(--bg-white);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.qty-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.qty-controls input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
}

.qty-controls input:focus {
    outline: none;
    border-color: var(--primary);
}

.qty-discount {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.discount-badge {
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.discount-badge.active {
    background: var(--primary);
    color: #fff;
}

.modal-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(22, 119, 255, 0.05);
    border: 1px dashed rgba(22, 119, 255, 0.3);
    border-radius: var(--radius);
    font-size: 15px;
}

.modal-total strong {
    font-size: 22px;
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(22, 119, 255, 0.1);
}

.result-icon {
    font-size: 48px;
    margin-bottom: 16px;
    text-align: center;
}

.result-msg {
    font-size: 16px;
    text-align: center;
    margin-bottom: 16px;
}

.result-data {
    background: var(--bg-light);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ============================================
   Search Modal
   ============================================ */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.search-modal.active {
    display: flex;
}

.search-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-box i {
    font-size: 20px;
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
}

.search-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   Mobile Overlay
   ============================================ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1999;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.25s ease;
}
.mobile-overlay.active { display: block; }

/* ============================================
   Mobile Menu Sidebar
   ============================================ */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 24px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
}

/* Sidebar Header */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mobile-menu-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f5f5f5;
    color: #595959;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}
.mobile-menu-close:hover { background: #ffebe6; color: #ff4d4f; }

/* User Card (logged in) */
.mob-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #e6f4ff, #f0f8ff);
    border-bottom: 1px solid #bae0ff;
}
.mob-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #1677ff;
    flex-shrink: 0;
}
.mob-user-info { flex: 1; min-width: 0; }
.mob-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f1f1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mob-user-balance {
    font-size: 0.82rem;
    color: #1677ff;
    font-weight: 600;
    margin-top: 2px;
}
.mob-user-balance i { font-size: 11px; }
.mob-topup-btn {
    padding: 6px 14px;
    background: #1677ff;
    color: #fff;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}
.mob-topup-btn:hover { background: #0958d9; color: #fff; }

/* Guest Card */
.mob-guest-card {
    padding: 16px 18px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}
.mob-guest-text {
    font-size: 0.82rem;
    color: rgba(0,0,0,0.45);
    margin-bottom: 12px;
    text-align: center;
}
.mob-guest-btns {
    display: flex;
    gap: 8px;
}
.mob-btn-login, .mob-btn-register {
    flex: 1;
    padding: 9px 0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.mob-btn-login {
    background: #fff;
    border: 1px solid #1677ff;
    color: #1677ff;
}
.mob-btn-login:hover { background: #e6f4ff; color: #1677ff; }
.mob-btn-register {
    background: #1677ff;
    border: 1px solid #1677ff;
    color: #fff;
}
.mob-btn-register:hover { background: #0958d9; color: #fff; }

/* Nav */
.mobile-nav { padding: 8px 0; flex: 1; }

.mob-nav-group-label {
    padding: 10px 18px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(0,0,0,0.35);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: rgba(0,0,0,0.72);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s ease;
    border-radius: 0;
}
.mobile-nav-link:hover {
    background: #f0f6ff;
    color: #1677ff;
    padding-left: 22px;
}

/* Icon badges */
.mob-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}
.mob-icon-home    { background: #1677ff; }
.mob-icon-wallet  { background: #52c41a; }
.mob-icon-ai      { background: #722ed1; }
.mob-icon-product { background: #fa8c16; }
.mob-icon-key     { background: #13c2c2; }
.mob-icon-order   { background: #eb2f96; }
.mob-icon-codex   { background: #1677ff; }
.mob-icon-api     { background: #595959; }

/* Quick Contact */
.mob-contacts {
    padding: 4px 0 8px;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}
.mob-contact-row {
    display: flex;
    gap: 10px;
    padding: 8px 18px;
}
.mob-contact-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.2s;
}
.mob-contact-btn:hover { opacity: 0.88; color: #fff; }
.mob-tg { background: #2AABEE; }
.mob-zl { background: #0068ff; }

/* Logout */
.mob-logout-wrap {
    padding: 12px 18px 20px;
    border-top: 1px solid #f0f0f0;
}
.mob-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.mob-logout-btn:hover { background: #ff4d4f; color: #fff; }

/* Old compat */
.mobile-menu-footer { display: none; }
.mobile-user { display: none; }


/* ============================================
   Chat Button
   ============================================ */
.chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(22, 119, 255, 0.4);
    transition: var(--transition);
    z-index: 500;
}

.chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.5);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    animation: slideInRight 0.3s ease;
    max-width: 360px;
}

.toast-success {
    background: #fff;
    border-left: 4px solid var(--success);
    color: var(--text-primary);
}

.toast-error {
    background: #fff;
    border-left: 4px solid var(--error);
    color: var(--text-primary);
}

.toast i:first-child {
    font-size: 20px;
}

.toast-success i:first-child {
    color: var(--success);
}

.toast-error i:first-child {
    color: var(--error);
}

.toast-close {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   Footer - Light Ant Design Style
   ============================================ */
.footer {
    background: #fafafa;
    color: rgba(0,0,0,0.65);
    margin-top: 60px;
    border-top: 1px solid #f0f0f0;
    position: relative;
}

/* Stats Bar */
.footer-stats-bar {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 20px 0;
}

.footer-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}

.footer-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 36px;
}

.footer-stat i {
    font-size: 26px;
    color: #1677ff;
}

.footer-stat div {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1f1f1f;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: rgba(0,0,0,0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.footer-stat-divider {
    width: 1px;
    height: 36px;
    background: #f0f0f0;
    flex-shrink: 0;
}

/* Footer Main */
.footer-main {
    padding: 48px 0 36px;
}

.footer-grid-new {
    display: grid;
    grid-template-columns: 2.2fr 1.3fr 1.3fr 1.5fr;
    gap: 40px;
}

/* Brand Column */
.footer-brand-col {}

.footer-logo-new {
    display: inline-block;
    margin-bottom: 16px;
}

.footer-desc-new {
    font-size: 0.875rem;
    line-height: 1.75;
    color: rgba(0,0,0,0.55);
    margin-bottom: 18px;
    max-width: 300px;
}

.footer-desc-new strong {
    color: #1677ff;
    font-weight: 600;
}

/* Social Icons */
.footer-social-new {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.footer-social-new a {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fff;
    transition: all 0.2s ease;
    border: none;
}

.footer-social-new a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.social-fb  { background: #1877F2; }
.social-tt  { background: #010101; }
.social-tg  { background: #2AABEE; }
.social-zl  { background: #0068ff; }
.social-dc  { background: #5865F2; }
.social-api { background: #1677ff; }

/* Trust Badges */
.footer-trust {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #e6f4ff;
    border: 1px solid #bae0ff;
    border-radius: 20px;
    font-size: 0.76rem;
    color: #1677ff;
    font-weight: 500;
}

.trust-badge i {
    color: #1677ff;
    font-size: 11px;
}

/* Link Columns */
.footer-links-col {}

.footer-col-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(0,0,0,0.88);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.footer-col-title i {
    color: #1677ff;
    font-size: 13px;
}

.footer-links-new {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.footer-links-new a {
    font-size: 0.865rem;
    color: rgba(0,0,0,0.55);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.18s ease;
}

.footer-links-new a i {
    font-size: 10px;
    color: #bfbfbf;
    transition: all 0.18s ease;
}

.footer-links-new a:hover {
    color: #1677ff;
    padding-left: 3px;
}

.footer-links-new a:hover i {
    color: #1677ff;
}

/* Contact Items */
.footer-contact-new {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.contact-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    color: #fff;
}

.contact-icon-fb  { background: #1877F2; }
.contact-icon-tg  { background: #2AABEE; }
.contact-icon-zl  { background: #0068ff; }
.contact-icon-em  { background: #EA4335; }
.contact-icon-cl  { background: #1677ff; }

.contact-item div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.contact-item small {
    font-size: 0.7rem;
    color: rgba(0,0,0,0.35);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.contact-item a, .contact-item span {
    font-size: 0.865rem;
    color: rgba(0,0,0,0.65);
    text-decoration: none;
    transition: color 0.18s ease;
    font-weight: 500;
}

.contact-item a:hover { color: #1677ff; }

/* Footer Bottom */
.footer-bottom-new {
    border-top: 1px solid #f0f0f0;
    padding: 16px 0;
    background: #f5f5f5;
}

.footer-bottom-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-bottom-inner p {
    font-size: 0.8rem;
    color: rgba(0,0,0,0.45);
    margin: 0;
}

.footer-bottom-inner strong {
    color: rgba(0,0,0,0.65);
}

.footer-bottom-links {
    display: flex;
    gap: 20px;
}

.footer-bottom-links a {
    font-size: 0.8rem;
    color: rgba(0,0,0,0.4);
    text-decoration: none;
    transition: color 0.18s ease;
}

.footer-bottom-links a:hover {
    color: #1677ff;
}

/* Keep old footer classes for main.php layout compatibility */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding-bottom: 32px; }
.footer-logo { font-size: 24px; font-weight: 700; color: var(--primary); display: block; margin-bottom: 12px; }
.footer-desc { font-size: 13px; line-height: 1.6; margin-bottom: 16px; color: rgba(0,0,0,0.55); }
.footer-social { display: flex; gap: 12px; }
.footer-social a { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: #f0f0f0; border-radius: var(--radius); transition: var(--transition); color: rgba(0,0,0,0.65); }
.footer-social a:hover { background: var(--primary); color: #fff; }
.footer-col h4 { font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.88); margin-bottom: 16px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 13px; color: rgba(0,0,0,0.55); transition: var(--transition); }
.footer-links a:hover { color: var(--primary); }
.footer-contact { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-contact li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(0,0,0,0.65); }
.footer-contact i { color: var(--primary); width: 16px; }
.footer-bottom { border-top: 1px solid #f0f0f0; padding: 16px 0; text-align: center; font-size: 12px; color: rgba(0,0,0,0.45); }


/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid-new {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-brand-col {
        grid-column: 1 / -1;
    }
    .footer-stat {
        padding: 0 24px;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .header-inner {
        gap: 12px;
    }
    .hero-content h1 {
        font-size: 24px;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .category-card {
        padding: 16px 8px;
    }
    .category-card i {
        font-size: 24px;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .footer-grid-new {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .footer-stats {
        gap: 10px;
        justify-content: space-around;
    }
    .footer-stat {
        padding: 8px 12px;
        gap: 10px;
    }
    .footer-stat-divider {
        display: none;
    }
    .footer-bottom-inner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .footer-bottom-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    .hero-buttons {
        flex-direction: column;
    }
    .hero-buttons .btn {
        width: 100%;
    }
    .social-login {
        flex-direction: column;
    }
}
