/* Modern CSS Reset & Variables */
:root {
    --primary: #0D8A5E;
    --primary-light: #20B07C;
    --primary-dark: #075E3F;
    --secondary: #1E293B;
    --bg-color: #F8FAFC;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(255, 255, 255, 0.5);
    --text-main: #0F172A;
    --text-muted: #64748B;
    --danger: #EF4444;
    --success: #10B981;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(153, 83%, 90%, 1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(210, 83%, 94%, 1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column; /* Stack top bar and content vertically */
    min-height: 100vh;
}

.sidebar {
    width: 100%;
    height: auto;
    padding: 0.75rem 2rem;
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    transform: translateY(-100%); /* Slide up instead of left */
    position: absolute;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo-container i {
    font-size: 2rem;
}

.logo-container h2 {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: row; /* Horizontal nav items */
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    padding: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(13, 138, 94, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 138, 94, 0.2);
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: 1.5rem;
    width: 100%;
}

/* No longer need expanded class since it's always full width */
.main-content.expanded {
    margin-left: 0;
}

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

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--secondary);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

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

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

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

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

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(13, 138, 94, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 138, 94, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 138, 94, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    background: #f1f5f9;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--danger);
}

#sidebar-toggle:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.w-100 {
    width: 100%;
}
.mt-2 {
    margin-top: 1.5rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.data-table th {
    background: rgba(0,0,0,0.02);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.5);
}

/* Forms */
.form-card {
    padding: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-group input, .form-group select {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.8);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 138, 94, 0.1);
}

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

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

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

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

.invoice-modal {
    max-width: 700px;
}

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

/* Grid Layouts */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Slip & Invoice Specifics */
.slip-preview {
    padding: 2rem;
}

.print-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed rgba(0,0,0,0.1);
}

.slip-details p {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.divider {
    height: 1px;
    background: rgba(0,0,0,0.1);
    margin: 1.5rem 0;
}

.hidden {
    display: none !important;
}

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

.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.print-only {
    display: none;
}

/* Print Styles - Mode-specific */
@media print {
    body * { visibility: hidden; }

    /* Invoice print mode */
    body.printing-invoice #print-invoice,
    body.printing-invoice #print-invoice * { visibility: visible; }
    body.printing-invoice #print-invoice {
        display: block; position: absolute;
        left: 0; top: 0; width: 100%; padding: 2rem;
    }

    /* Voucher print mode */
    body.printing-voucher #print-voucher,
    body.printing-voucher #print-voucher * { visibility: visible; }
    body.printing-voucher #print-voucher {
        display: block; position: absolute;
        left: 0; top: 0; width: 100%; padding: 2rem;
    }

    /* Slip print mode */
    body.printing-slip #slip-container,
    body.printing-slip #slip-container * { visibility: visible; }
    body.printing-slip #slip-container {
        position: absolute; left: 0; top: 0;
        width: 100%; padding: 2rem;
    }

    .invoice-header {
        text-align: center;
        margin-bottom: 2rem;
        border-bottom: 2px solid #000;
        padding-bottom: 1rem;
    }
    .invoice-meta {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2rem;
    }
    .invoice-totals {
        margin-top: 2rem;
        text-align: right;
        border-top: 1px solid #000;
        padding-top: 1rem;
    }
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(153, 83%, 90%, 1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(210, 83%, 94%, 1) 0px, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.85);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.ms-2 {
    margin-left: 0.5rem;
}

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