@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #0b0f19;
    --surface: #1e293b;
    --surface-hover: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --danger: #ef4444;
    --success: #10b981;
}

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

body {
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism utility */
.glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    height: 100vh;
    background: radial-gradient(circle at 50% -20%, #1e3a8a 0%, var(--bg) 50%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: 1rem;
    text-align: center;
}

.login-box h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
    box-shadow: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: rgba(15, 23, 42, 0.8);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

/* Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
}

/* Tables */
.table-container {
    border-radius: 1rem;
    overflow-x: auto;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th, td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: rgba(15, 23, 42, 0.6);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge-primary { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 2rem;
}

.card {
    padding: 1.75rem;
    border-radius: 1rem;
}

.card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.alert-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Invoice Specific */
.invoice-print-area {
    background: #fff;
    color: #000;
    padding: 3rem;
    border-radius: 0.5rem;
    max-width: 800px;
    margin: 0 auto;
}
.invoice-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #eee;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.invoice-title {
    font-size: 2.5rem;
    color: #333;
    font-weight: 700;
}
.invoice-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}
.invoice-box {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 0.25rem;
    width: 48%;
}
.invoice-box strong { display: block; margin-bottom: 0.25rem; color: #555; }
.invoice-table th { background: #333; color: #fff; }
.invoice-table td, .invoice-table th { padding: 0.75rem; border-color: #ddd; }
.invoice-total { text-align: right; margin-top: 1.5rem; font-size: 1.2rem; }

/* Layout for print */
@media print {
    body { background: white; color: black; }
    .sidebar, .btn, .no-print, .header { display: none !important; }
    .main-content { padding: 0; }
    .glass { background: none; border: none; box-shadow: none; }
    .invoice-print-area { padding: 0; box-shadow: none; max-width: 100%; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
    }
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    .nav-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    .main-content {
        padding: 1.5rem 1rem;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .table-container {
        overflow-x: auto;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .invoice-grid {
        grid-template-columns: 1fr !important;
    }
}
