/* Base styles and variables */
:root {
    --bg-color: #0b0c10;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --brand-primary: #4338ca; 
    --brand-secondary: #6366f1;
    --brand-glow: rgba(99, 102, 241, 0.3);
    
    --card-bg: rgba(31, 41, 55, 0.4);
    --card-border: rgba(255, 255, 255, 0.08);
    
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utilities */
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.full-width { width: 100%; }

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; overflow: hidden;
}

.glow {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.5;
}

.glow-1 {
    top: -10%; right: -5%; width: 40vw; height: 40vw;
    background: radial-gradient(circle, var(--brand-glow) 0%, rgba(0,0,0,0) 70%);
    animation: drift 20s infinite alternate;
}

.glow-2 {
    bottom: -10%; left: -10%; width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(0,0,0,0) 70%);
    animation: drift 25s infinite alternate-reverse;
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.view {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Login View */
#loginView { justify-content: center; align-items: center; }
.login-card { padding: 3.5rem; text-align: center; max-width: 450px; width: 90%; }
.logo-container {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 24px;
    display: flex; justify-content: center; align-items: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 30px var(--brand-glow);
}
.icon-brand { font-size: 2.5rem; color: white; }
.login-card h1 { font-weight: 600; font-size: 2rem; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.5; }

.error-msg {
    color: #ffbaba; background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 0.8rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.9rem;
}

.auth-buttons {
    display: flex; flex-direction: column; gap: 1rem;
}

/* Buttons */
.primary-btn, .secondary-btn, .danger-btn {
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.danger-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.danger-btn:hover { background: rgba(239, 68, 68, 0.2); }

.primary-btn {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white; width: 100%;
    box-shadow: 0 4px 12px var(--brand-glow);
}

.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--brand-glow); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.secondary-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}
.secondary-btn:hover { background: rgba(255,255,255,0.1); }

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}
.form-group label {
    display: block; font-size: 0.85rem; color: var(--text-secondary);
    margin-bottom: 0.4rem; font-weight: 500;
}
.form-group input, .form-group select {
    width: 100%; padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white; font-size: 1rem; outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--brand-secondary);
}
.form-group select option { background: #1f2937; }

/* Dashboard Nav */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem; margin: 1rem 2rem; border-radius: 16px;
}
.nav-brand {
    display: flex; align-items: center; gap: 0.8rem;
    font-weight: 600; font-size: 1.2rem; letter-spacing: 0.5px;
}
.icon-brand-small { color: var(--brand-secondary); }

.icon-btn {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 1.2rem; cursor: pointer; transition: color 0.2s; padding: 0.5rem;
}
.icon-btn:hover { color: var(--text-primary); }

/* Dashboard Layout */
.dashboard-content {
    padding: 1rem 2rem 3rem;
    max-width: 1200px; margin: 0 auto; width: 100%;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2rem;
    align-items: start;
}

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

.card {
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: 20px; padding: 1.8rem;
}

.card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.8rem;
}
.card-header h2 { font-weight: 600; font-size: 1.2rem; letter-spacing: 0.5px; }
.account-badge { background: rgba(255,255,255,0.1); padding: 0.4rem 0.8rem; border-radius: 8px; font-size: 0.85rem; color: var(--text-secondary); }

.balance-preview {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.2rem; background: rgba(0,0,0,0.2); border-radius: 12px; border: 1px solid var(--card-border);
}
.balance-preview span { color: var(--text-secondary); font-size: 0.9rem; }
.balance-preview h3 { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }

/* Employees */
.employee-list { display: flex; flex-direction: column; gap: 1rem; }

.employee-row {
    background: rgba(0,0,0,0.2); border-radius: 16px;
    border: 1px solid var(--card-border); padding: 1.2rem;
    display: flex; flex-direction: column; gap: 1.2rem;
    transition: transform 0.2s;
}

.employee-row:hover { transform: translateY(-3px); }

.employee-row-top { display: flex; justify-content: space-between; align-items: center; }

.employee-info { display: flex; align-items: center; gap: 1rem; }
.employee-avatar {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; justify-content: center; align-items: center;
    font-weight: 600; font-size: 1.1rem; color: white;
}

.employee-info h3 { font-size: 1.1rem; font-weight: 500; }
.employee-info p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.2rem; }

.employee-net { text-align: right; }
.net-pay-val { font-size: 1.6rem; font-weight: 600; font-family: monospace; display: block; }
.net-pay-label { font-size: 0.8rem; color: var(--success); text-transform: uppercase; font-weight: 500; letter-spacing: 1px; }

.employee-breakdown {
    display: flex; justify-content: space-between; align-items: flex-end;
    padding-top: 1rem; border-top: 1px dashed rgba(255,255,255,0.1);
}

.breakdown-stats {
    display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.stat-item { display: flex; flex-direction: column; gap: 0.2rem; }
.stat-item span { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-item strong { font-size: 0.95rem; font-family: monospace; }
.stat-item.danger strong { color: var(--danger); }
.stat-item.success strong { color: var(--success); }

.view-expenses-btn {
    font-size: 0.8rem; padding: 0.5rem 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 100;
}
.modal-content { max-width: 400px; width: 90%; padding: 2.5rem; }
.modal-content.m-large { max-width: 600px; padding: 2rem; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; border-bottom: 1px solid var(--card-border); padding-bottom: 1rem; }
.modal-header h2 { font-weight: 500; font-size: 1.3rem; }

.expense-breakdown { display: flex; flex-direction: column; gap: 1.5rem; }
.breakdown-section h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; font-weight: 500; }

.expense-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.2); padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 0.5rem;
}
.expense-item-desc { font-size: 0.9rem; }
.expense-item-amt { font-family: monospace; font-weight: 500; }

.charge-section .expense-item-amt { color: var(--danger); }
.credit-section .expense-item-amt { color: var(--success); }

.success-icon { font-size: 4rem; color: var(--success); margin-bottom: 1rem; }
.receipt-details { background: rgba(0,0,0,0.3); border-radius: 12px; padding: 1.5rem; margin-bottom: 2rem; text-align: left; }
.receipt-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.receipt-row span:last-child { font-weight: 500; color: white; font-family: monospace;}

/* History View */
.history-list {
    display: flex; flex-direction: column; gap: 1rem;
    max-height: 60vh; overflow-y: auto; padding-right: 0.5rem;
}
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.history-run {
    background: rgba(0,0,0,0.3); padding: 1.2rem; border-radius: 12px;
    border: 1px solid var(--card-border);
    transition: all 0.2s;
}
.history-run:hover { border-color: rgba(255,255,255,0.2); }
.history-run-head { display: flex; justify-content: space-between; margin-bottom: 0.8rem; }
.history-date { font-weight: 500; font-size: 1.1rem; color: var(--brand-secondary); }
.history-submitted { font-size: 0.8rem; color: var(--text-secondary); }

.loader { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: white; animation: spin 1s ease-in-out infinite; margin: 1.5rem auto 0; }
.hidden { display: none !important; }

/* Animations */
@keyframes drift { 0% { transform: translate(0, 0); } 100% { transform: translate(5%, 5%); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.8s ease forwards; }
.slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.slide-down { animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pop-in { animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
