/* Font: Be Vietnam Pro — hiển thị tiếng Việt rõ, cân bằng hơn font hệ thống mặc định */
@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

/* CSS Variables */
:root {
    /* Colors */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --primary-rgb: 59, 130, 246;

    --secondary: #8b5cf6;
    --secondary-dark: #7c3aed;
    --secondary-light: #ede9fe;
    --secondary-rgb: 139, 92, 246;

    --success: #22c55e;
    --success-dark: #16a34a;
    --success-light: #dcfce7;

    --warning: #f59e0b;
    --warning-dark: #d97706;
    --warning-light: #fef3c7;

    --error: #ef4444;
    --error-dark: #dc2626;
    --error-light: #fee2e2;

    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #111827;

    /* Typography — Be Vietnam Pro (có dấu tiếng Việt); không dùng Inter (thiếu glyph VN) */
    --font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto,
        "Helvetica Neue", sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;
    --spacing-16: 4rem;
    --spacing-20: 5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    /* Transitions */
    --transition: all 0.2s ease-in-out;
    --transition-fast: all 0.1s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}


/* Light Theme Variables */
:root {
    --bg-primary: var(--neutral-50);
    --bg-secondary: #ffffff;
    --bg-tertiary: var(--neutral-100);
    --text-primary: var(--neutral-900);
    --text-secondary: var(--neutral-700);
    --text-muted: var(--neutral-500);
    --border-color: var(--neutral-200);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Background for auth pages */
body.auth-page {
    background: var(--bg-primary);
    position: relative;
}

body.auth-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body.auth-page .container {
    position: relative;
    z-index: 1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-4);
    color: var(--text-primary);
}

h1,
h2,
h3 {
    letter-spacing: -0.02em;
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--spacing-4);
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ===========================================
   Trải nghiệm dùng: skip link, main, form, reduce motion
   ========================================== */

/* “Bỏ qua” menu — chỉ thấy khi Tab */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0.75rem;
    z-index: 10000;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: #fff !important;
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0.75rem;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

#main-content {
    scroll-margin-top: 5.5rem;
}

@media (max-width: 768px) {
    #main-content {
        scroll-margin-top: 4.25rem;
    }
}

button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.form-input:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-4);
}

/* Mobile Container */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-3);
        width: 100%;
    }
}

/* Container for auth pages */
.auth-page .container {
    max-width: none;
    padding: 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

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

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

.text-muted {
    color: var(--text-muted);
}

.bg-primary {
    background-color: var(--primary);
}

.bg-success {
    background-color: var(--success);
}

.bg-warning {
    background-color: var(--warning);
}

.bg-error {
    background-color: var(--error);
}

.mt-1 {
    margin-top: var(--spacing-1);
}

.mt-2 {
    margin-top: var(--spacing-2);
}

.mt-3 {
    margin-top: var(--spacing-3);
}

.mt-4 {
    margin-top: var(--spacing-4);
}

.mt-5 {
    margin-top: var(--spacing-5);
}

.mt-6 {
    margin-top: var(--spacing-6);
}

.mb-1 {
    margin-bottom: var(--spacing-1);
}

.mb-2 {
    margin-bottom: var(--spacing-2);
}

.mb-3 {
    margin-bottom: var(--spacing-3);
}

.mb-4 {
    margin-bottom: var(--spacing-4);
}

.mb-5 {
    margin-bottom: var(--spacing-5);
}

.mb-6 {
    margin-bottom: var(--spacing-6);
}

.p-1 {
    padding: var(--spacing-1);
}

.p-2 {
    padding: var(--spacing-2);
}

.p-3 {
    padding: var(--spacing-3);
}

.p-4 {
    padding: var(--spacing-4);
}

.p-5 {
    padding: var(--spacing-5);
}

.p-6 {
    padding: var(--spacing-6);
}

/* ========================================
   Mobile-First Responsive Design
   ======================================== */

@media (max-width: 768px) {
    /* Base Typography - Mobile Optimized */
    html {
        font-size: 14px; /* Smaller base font for mobile */
    }

    body {
        font-size: var(--font-size-sm);
        line-height: 1.5;
    }

    h1 {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--spacing-3);
        line-height: 1.2;
    }

    h2 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--spacing-3);
        line-height: 1.3;
    }

    h3 {
        font-size: var(--font-size-lg);
        margin-bottom: var(--spacing-2);
        line-height: 1.3;
    }

    h4 {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-2);
    }

    p {
        margin-bottom: var(--spacing-3);
        font-size: var(--font-size-sm);
    }

    /* Container - Mobile Optimized */
    .container {
        padding: 0 var(--spacing-3);
        max-width: 100%;
    }

    /* Index page specific - remove all top spacing, allow full-width hero */
    .app-container .main-content .container {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Hero section full width on mobile */
    .main-content .container .hero-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* Remove any default margins from first child */
    .main-content > .container > *:first-child {
        margin-top: 0 !important;
    }

    /* App Container - Account for tabbar */
    .app-container {
        min-height: 100vh;
        padding-bottom: 0; /* Tabbar handles bottom spacing */
    }

    /* Vùg chạm tối thiểu: nút & liên kết điều hướng (không ép mọi thẻ button nhỏ) */
    .btn,
    [type="submit"],
    .nav-link,
    .mobile-burger,
    .tab-btn,
    .receipt-action-btn,
    .receipt-attachment,
    .receipt-link,
    .receipt-image,
    .mobile-nav-drawer a {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 40px;
    }
}