:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.2) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.2) 0, transparent 50%);
    background-attachment: fixed;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
}

/* Layout */
.sidebar {
    width: 250px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid var(--surface-border);
}

.brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.nav-links li a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    display: block;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-links li a:hover, .nav-links li a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

h1 {
    font-size: 28px;
    font-weight: 600;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

.btn-success {
    background: var(--success-color);
    color: white;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card .title {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

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

th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-ongoing { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge-completed { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-unpaid { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-paid { background: rgba(16, 185, 129, 0.2); color: #34d399; }

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 500px;
    padding: 32px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.show .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-family);
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Sections */
.view-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view-section.active {
    display: block;
}

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

/* Utilities */
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.flex-gap { display: flex; gap: 8px; }

/* Invoice Print Styles */
#printArea { display: none; }
@media print {
    @page {
        margin: 0; /* Remove default browser margins */
        size: A4 portrait;
    }
    body {
        margin: 1cm; /* Set our own margin */
    }
    body * { visibility: hidden; }
    #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 20px; background: white; }
    #printArea, #printArea * { visibility: visible; color: black !important; }
    .glass { background: white; border: none; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid var(--surface-border);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .brand {
        font-size: 20px;
    }
    
    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        margin-top: 10px;
    }
    
    .nav-links li a {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .flex-gap {
        flex-direction: column;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    header button {
        width: 100%;
        justify-content: center;
    }
}
