/* ============================================
   SPENDNOTE - MASTER DESIGN SYSTEM
   One unified stylesheet for ALL pages
   ============================================ */

/* ========================================
   0. GLOBAL RESET - No focus outlines
   ======================================== */
*:focus,
*:focus-visible {
    outline: none !important;
}

/* ========================================
   1. CSS VARIABLES
   ======================================== */
:root {
    /* Brand Colors */
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
    --orange: #f59e0b;
    --out: #6B7280;
    --out-rgb: 107, 114, 128;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    
    /* Backgrounds */
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-elevated: #d8d8d8;
    
    /* Text */
    --text: #0a0a0a;
    --text-muted: #737373;
    
    /* Borders & Shadows */
    --border: rgba(0,0,0,0.08);
    --shadow: rgba(0,0,0,0.04);
    
    /* Status */
    --error: #ef4444;
    --success: #059669;
    --warning: #f59e0b;
    
    /* Active (Dynamic) */
    --active: #059669;
    --active-rgb: 5, 150, 105;
    
    /* Typography Scale */
    --font-xs: 0.75rem;    /* 12px */
    --font-sm: 0.875rem;   /* 14px */
    --font-base: 0.9375rem;/* 15px - BASE SIZE */
    --font-md: 1rem;       /* 16px */
    --font-lg: 1.125rem;   /* 18px */
    --font-xl: 1.25rem;    /* 20px */
    --font-2xl: 1.5rem;    /* 24px */
    --font-3xl: 1.875rem;  /* 30px */
    --font-4xl: 2.25rem;   /* 36px */
    
    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Standard Dimensions */
    --nav-height: 72px;
    --max-width-page: 1400px;
    --max-width-form: 1000px;
    --page-gutter: 3rem;

    --logo-optical-offset: -8px;
}

/* ========================================
   2. RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: clip;
    scroll-behavior: smooth;
    font-size: 100%; /* Always 16px base, use rem for everything */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: var(--font-base); /* 15px */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
}

/* ========================================
   3. NAVIGATION (UNIFIED)
   ======================================== */
.site-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0; /* 20px vertical */
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--shadow);
    height: var(--nav-height); /* 72px */
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: var(--max-width-page);
    margin: 0 auto;
    padding: 0 var(--page-gutter); /* 48px horizontal */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Logo */
.site-nav .logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.site-nav .logo:hover {
    transform: scale(1.02);
}

.site-nav .logo svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    margin-left: var(--logo-optical-offset);
}

.site-nav .logo span {
    font-size: var(--font-2xl); /* 24px */
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Navigation Links */
.site-nav .nav-links {
    display: flex;
    gap: 1.5rem; /* 24px - tighter spacing */
    align-items: center;
    list-style: none;
}

.site-nav .nav-links a:not(.btn):not(.nav-cash-item),
.site-nav .nav-links button:not(.btn) {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-base); /* 15px */
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.site-nav .nav-links a:not(.btn):not(.nav-cash-item):hover {
    color: var(--active);
}

/* Cash-related nav items (Dashboard, Cash Boxes, Transactions) - Dynamic color via JS */
.site-nav .nav-links a.nav-cash-item {
    color: var(--active);
    font-weight: 600;
    text-decoration: none;
    font-size: var(--font-base);
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.site-nav .nav-links a.nav-cash-item:hover {
    opacity: 0.8;
}

/* Nav buttons keep their button styling */
.site-nav .nav-links .btn-primary {
    color: white !important;
}

.site-nav .nav-links .btn-primary:hover {
    color: white !important;
}

.site-nav .nav-links .btn-secondary {
    color: var(--text) !important;
}

.site-nav .nav-links .btn-secondary:hover {
    color: var(--active) !important;
}

.site-nav .nav-links a.active {
    color: var(--active);
    position: relative;
    box-shadow: inset 0 -3px 0 var(--active);
}

/* ========================================
   4. BUTTONS (UNIFIED)
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: var(--font-base); /* 15px */
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.4);
    color: white !important;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text) !important;
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--active);
    color: var(--active) !important;
}

.btn-large {
    padding: 16px 32px;
    font-size: var(--font-lg);
}

.btn-small {
    padding: 8px 16px;
    font-size: var(--font-sm);
}

/* ========================================
   5. TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: var(--font-4xl); } /* 36px */
h2 { font-size: var(--font-3xl); } /* 30px */
h3 { font-size: var(--font-2xl); } /* 24px */
h4 { font-size: var(--font-xl); }  /* 20px */
h5 { font-size: var(--font-lg); }  /* 18px */
h6 { font-size: var(--font-md); }  /* 16px */

p {
    margin-bottom: var(--space-md);
    color: var(--text);
}

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

/* ========================================
   6. LAYOUT CONTAINERS
   ======================================== */
.app-container {
    max-width: var(--max-width-page); /* 1400px */
    margin: 0 auto;
    padding: var(--space-xl); /* 32px */
    flex: 1;
    width: 100%;
}

.form-container {
    max-width: var(--max-width-form); /* 1000px */
    margin: 0 auto;
    padding: var(--space-xl);
    width: 100%;
}

main {
    flex: 1;
    overflow-x: hidden;
}

/* ========================================
   7. CARDS & SURFACES
   ======================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 24px var(--shadow);
}

/* ========================================
   8. FORMS
   ======================================== */
input,
select,
textarea {
    font-family: inherit;
    font-size: var(--font-base);
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s ease;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--active);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--active-rgb), 0.1);
}

label {
    font-weight: 600;
    font-size: var(--font-sm);
    color: var(--text);
    margin-bottom: var(--space-sm);
    display: block;
}

/* ========================================
   9. FOOTER (UNIFIED)
   ======================================== */
.app-footer {
    background: #4a4a4a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-xl) 0;
    margin-top: auto;
}

.app-footer-container {
    max-width: var(--max-width-page);
    margin: 0 auto;
    padding: 0 var(--page-gutter);
}

.app-footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
    gap: var(--space-xl);
}

.app-footer-brand {
    max-width: 450px;
    flex: 1;
}

.app-footer-brand-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    margin-bottom: var(--space-md);
}

.app-footer-brand-logo svg {
    width: 32px;
    height: 32px;
    opacity: 0.95;
    margin-left: var(--logo-optical-offset);
}

.app-footer-brand-logo span {
    font-size: var(--font-xl);
    font-weight: 900;
    color: white;
    letter-spacing: -0.02em;
}

.app-footer-brand-desc {
    font-size: var(--font-sm);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: var(--space-md);
    max-width: 100%;
}

.app-footer-brand-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    font-size: var(--font-xs);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 350px;
}

.app-footer-brand-disclaimer i {
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}

.app-footer-right {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    align-items: flex-end;
    text-align: right;
}

.app-footer-links-simple {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

.app-footer-links-simple a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-base);
    transition: color 0.2s ease;
}

.app-footer-links-simple a:hover {
    color: white;
}

.app-footer-bottom {
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.app-footer-copyright {
    font-size: var(--font-sm);
    color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   10. UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

/* ========================================
   11. APP-SPECIFIC COMPONENTS
   ======================================== */

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--surface);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 8px 24px var(--shadow);
    transform: translateY(-2px);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

thead {
    background: var(--surface-elevated);
}

th {
    text-align: left;
    padding: var(--space-md);
    font-weight: 700;
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    font-size: var(--font-base);
}

tr:hover {
    background: var(--surface-elevated);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(var(--active-rgb), 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--orange);
}

 .pro-badge,
 .upgrade-badge {
     display: inline-flex !important;
     align-items: center !important;
     gap: 6px !important;
     padding: 4px 10px !important;
     background: rgba(245, 158, 11, 0.12) !important;
     border: 1px solid rgba(245, 158, 11, 0.28) !important;
     border-radius: var(--radius-full) !important;
     font-size: 11px !important;
     font-weight: 800 !important;
     letter-spacing: 0.06em !important;
     text-transform: uppercase !important;
     line-height: 1 !important;
     color: var(--orange) !important;
 }

 .upgrade-badge {
     margin-left: 8px !important;
 }

 .pro-badge i,
 .upgrade-badge i {
     color: currentColor !important;
     font-size: 11px !important;
 }

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* ========================================
   12. RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .site-nav .nav-links {
        gap: var(--space-md);
    }
    
    .app-container,
    .form-container {
        padding: var(--space-lg) var(--space-md);
    }
    
    h1 { font-size: var(--font-3xl); }
    h2 { font-size: var(--font-2xl); }
    h3 { font-size: var(--font-xl); }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .app-footer-top {
        flex-direction: column;
    }
    
    .app-footer-links-simple {
        flex-direction: column;
        gap: var(--space-md);
    }
}

/* ========================================
   13. BRANDED DIALOG MODALS
   ======================================== */
.sn-dialog-overlay {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.sn-dialog-card {
    background: var(--surface, #fff);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 32px 28px 24px;
    max-width: 420px;
    width: calc(100% - 32px);
    text-align: center;
    animation: snDialogPop 0.2s ease;
}

@keyframes snDialogPop {
    from { transform: scale(0.92) translateY(8px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.sn-dialog-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
    line-height: 1;
}

.sn-dialog-title {
    font-size: var(--font-lg, 1.125rem);
    font-weight: 800;
    color: var(--text, #0a0a0a);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.sn-dialog-message {
    font-size: var(--font-sm, 0.875rem);
    color: var(--text-muted, #737373);
    line-height: 1.6;
    margin-bottom: 20px;
    word-break: break-word;
}

.sn-dialog-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: var(--font-base, 0.9375rem);
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: var(--radius-md, 12px);
    background: var(--surface, #fff);
    color: var(--text, #0a0a0a);
    margin-bottom: 20px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.sn-dialog-input:focus {
    border-color: var(--active, #059669);
    box-shadow: 0 0 0 3px rgba(var(--active-rgb, 5, 150, 105), 0.12);
    outline: none;
}

.sn-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.sn-dialog-btn {
    padding: 10px 22px;
    border-radius: var(--radius-md, 12px);
    font-weight: 700;
    font-size: var(--font-sm, 0.875rem);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    min-width: 90px;
    line-height: 1.4;
}

.sn-dialog-btn:hover {
    transform: translateY(-1px);
}

.sn-dialog-btn:active {
    transform: translateY(0);
}

.sn-dialog-btn-primary {
    background: linear-gradient(135deg, var(--primary, #059669), var(--primary-light, #10b981));
    color: #fff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.sn-dialog-btn-primary:hover {
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.sn-dialog-btn-secondary {
    background: var(--surface, #fff);
    color: var(--text, #0a0a0a);
    border: 1.5px solid var(--border, rgba(0,0,0,0.08));
}

.sn-dialog-btn-secondary:hover {
    border-color: var(--text-muted, #737373);
}

.sn-dialog-btn-danger {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.sn-dialog-btn-danger:hover {
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

@media (max-width: 480px) {
    .sn-dialog-card {
        padding: 24px 20px 20px;
        max-width: 340px;
    }
    .sn-dialog-actions {
        flex-direction: column-reverse;
    }
    .sn-dialog-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .site-nav {
        padding: var(--space-sm) 0;
        height: auto;
    }
    
    .nav-container {
        padding: 0 var(--space-md);
    }
    
    .site-nav .logo span {
        font-size: var(--font-xl);
    }
    
    .site-nav .logo svg {
        width: 28px;
        height: 28px;
    }
}
