@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --emerald: #10b981;
    --emerald-light: #34d399;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --violet: #8b5cf6;
    --sky: #0ea5e9;
    --surface: rgba(255,255,255,0.85);
    --surface-hover: rgba(255,255,255,0.95);
    --border: rgba(226,232,240,0.8);
    --border-hover: rgba(99,102,241,0.3);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(99,102,241,0.1), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(99,102,241,0.18), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 60px rgba(99,102,241,0.22), 0 8px 20px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    font-family: 'DM Sans', 'Inter', 'Segoe UI', sans-serif;
    font-size: 15px;
    background: #f1f5f9;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-weight: 400;
    letter-spacing: 0.1px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.45); }

/* ── Links ─────────────────────────────────────────────────────── */
a, .btn-link { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── Headings ──────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.3px;
}
h1:focus { outline: none; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.45);
    background: linear-gradient(135deg, #4338ca, var(--primary-dark));
    color: #fff;
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* ── Fixed Save Button ─────────────────────────────────────────── */
.btn-save-fixed {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 2rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(99,102,241,0.4);
    transition: var(--transition);
    letter-spacing: 0.3px;
}
.btn-save-fixed:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(99,102,241,0.5);
}
.btn-save-fixed:active { transform: translateY(-1px); }

/* ── Status Badges ─────────────────────────────────────────────── */
.badge-paid    { background: #d1fae5; color: #065f46; border-radius: 6px; padding: 2px 8px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; }
.badge-partial { background: #dbeafe; color: #1e40af; border-radius: 6px; padding: 2px 8px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; }
.badge-pending { background: #fef3c7; color: #92400e; border-radius: 6px; padding: 2px 8px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; }
.badge-fifo    { background: #fef3c7; color: #d97706; border-radius: 6px; padding: 2px 8px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; }
.badge-batch   { background: #ede9fe; color: #4f46e5; border-radius: 6px; padding: 2px 8px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.3px; }

/* ── Validation ────────────────────────────────────────────────── */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--emerald); }
.invalid { outline: 1px solid var(--rose); }
.validation-message { color: var(--rose); font-size: 0.75rem; }

/* ── Error Boundary ────────────────────────────────────────────── */
.blazor-error-boundary {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: var(--radius-md);
    padding: 1rem 1rem 1rem 3.7rem;
    color: #be123c;
}
.blazor-error-boundary::after { content: "An error has occurred." }

/* ── Content ───────────────────────────────────────────────────── */
.content { padding: 0; }

/* ── Premium Glass Card ────────────────────────────────────────── */
.glass-card {
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}
.glass-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* ── Page Entrance Animation ───────────────────────────────────── */
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: pageEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ── Tooltip ───────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Ripple Effect ─────────────────────────────────────────────── */
.ripple {
    position: relative;
    overflow: hidden;
}
.ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}
.ripple:active::after { opacity: 1; }

/* ── Fixed Navbar ──────────────────────────────────────────────── */
/* NOTE: Navbar styling is handled by Components/Layout/NavMenu.razor.css
   Do NOT add background, color, or other styling here to avoid conflicts.
   Only positioning and z-index should be set here. */
.navbar, nav, .top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
}

/* Adjust body padding to account for fixed navbar */
body {
    padding-top: 0;
}
