/* ═══════════════════════════════════════════════════
   BL Daily Pay — Design System
   Professional Wage Calculator Software
   ═══════════════════════════════════════════════════ */

/* ─── CSS Variables / Design Tokens ─── */
:root {
    /* Colors — Soft Professional */
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-primary-light: #DBEAFE;
    --color-primary-bg: #EFF6FF;

    --color-success: #059669;
    --color-success-light: #D1FAE5;
    --color-success-bg: #ECFDF5;

    --color-warning: #D97706;
    --color-warning-light: #FEF3C7;
    --color-warning-bg: #FFFBEB;

    --color-danger: #DC2626;
    --color-danger-light: #FEE2E2;
    --color-danger-bg: #FEF2F2;

    --color-info: #0891B2;
    --color-info-light: #CFFAFE;

    /* Surfaces */
    --bg-body: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #1E3A5F;
    --bg-sidebar-hover: #254A75;
    --bg-sidebar-active: #2563EB;
    --bg-header: #FFFFFF;

    /* Text */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-inverse: #F8FAFC;
    --text-sidebar: #CBD5E1;
    --text-sidebar-active: #FFFFFF;

    /* Borders */
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;

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

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --header-height: 60px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Font */
    --font-body: 'Sarabun', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

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

small {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   LICENSE OVERLAY
   ═══════════════════════════════════════════════════ */

.license-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #1E3A5F 100%);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.license-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.license-logo {
    margin-bottom: var(--space-lg);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #1E3A5F, #2563EB);
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.license-logo h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.license-tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.license-version {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.license-form {
    margin-bottom: var(--space-lg);
    text-align: left;
}

.license-form label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.license-input-group {
    display: flex;
    gap: var(--space-sm);
}

.license-input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border-color var(--transition-fast);
    outline: none;
}

.license-input-group input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.license-error {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.license-success {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-success-bg);
    color: var(--color-success);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.license-actions {
    margin-bottom: var(--space-lg);
}

.license-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.license-footer p {
    margin-bottom: var(--space-xs);
}

.license-contact {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3B82F6, #60A5FA);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-inverse);
    line-height: 1.2;
}

.brand-version {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    padding: 1px 6px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    display: inline-block;
    width: fit-content;
    margin-top: 2px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-sidebar);
    font-size: 1.25rem;
    cursor: pointer;
    padding: var(--space-xs);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-md) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem var(--space-lg);
    color: var(--text-sidebar);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-inverse);
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: white;
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.nav-label small {
    font-size: 0.6875rem;
    opacity: 0.6;
    color: inherit;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.625rem;
    padding: 1px 6px;
    background: rgba(217, 119, 6, 0.3);
    color: #FCD34D;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.nav-divider {
    padding: var(--space-md) var(--space-lg) var(--space-xs);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
}

.license-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.license-tier {
    padding: 1px 8px;
    background: rgba(5, 150, 105, 0.3);
    color: #6EE7B7;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.6875rem;
}

.license-expiry {
    opacity: 0.6;
    font-size: 0.6875rem;
}

.company-info {
    opacity: 0.5;
    font-size: 0.6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-upgrade-sidebar {
    width: 100%;
    margin: 0.375rem 0;
    padding: 0.5rem;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: opacity .15s;
}
.btn-upgrade-sidebar:hover { opacity: .85; }

/* ─── Main Content ─── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

/* ─── Top Header ─── */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-xl);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-left h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: var(--space-xs);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.header-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.header-time {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-bg);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
}

/* ─── Page Container ─── */
.page-container {
    flex: 1;
    padding: var(--space-xl);
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

/* ─── Page Actions ─── */
.page-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    .main-content {
        margin-left: 0;
    }
    .hamburger {
        display: block;
    }
    .sidebar-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: var(--space-md);
    }
    .top-header {
        padding: 0 var(--space-md);
    }
    .header-left h2 {
        font-size: 0.9375rem;
    }
    .card-grid-2 {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .license-input-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Sidebar Overlay (mobile) ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}
