/* Donezo-inspired ERP Aesthetic */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-variable.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
    font-style: normal;
}

:root {
    /* Color Palette based on design */
    --primary-green: #1f603c;
    --primary-dark: #123f26;
    --primary-light: #e6f3eb;
    --bg-body: #f7f9fa;
    --bg-surface: #ffffff;
    
    /* Text */
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    /* Metrics & Spacing */
    --sidebar-width: 260px;
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 24px;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    --border-color: #f3f4f6;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

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

/* ---------------- Sidebar ---------------- */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1040;
    transition: transform 0.3s ease;
    padding: 1.5rem 0;
    overflow-y: auto; /* Allow scrolling for long menus */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 1.5rem 2rem 1.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    text-decoration: none;
}
.sidebar-logo svg {
    color: var(--primary-green);
}

/* Menu Labels */
.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin: 1.5rem 1.5rem 0.5rem 1.5rem;
}

/* Menu Links */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    /* Removed flex: 1 to prevent squishing multiple lists */
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}
.nav-link:hover {
    color: var(--primary-green);
    background-color: #fafafa;
}
.nav-link.active {
    color: var(--primary-green);
    font-weight: 600;
    border-left: 4px solid var(--primary-green);
    background-color: var(--primary-light);
}
.nav-link svg {
    stroke-width: 2;
    opacity: 0.7;
}
.nav-link.active svg {
    opacity: 1;
}

/* Support Widget */
.sidebar-widget {
    background: linear-gradient(145deg, var(--primary-dark), var(--primary-green));
    border-radius: var(--radius-md);
    padding: 1.5rem;
    color: white;
    margin: 1.5rem;
    position: relative;
    overflow: hidden;
}
.sidebar-widget h6 { color: white; font-weight: 600; font-size: 1rem; margin-bottom: 0.5rem; }
.sidebar-widget p { font-size: 0.8rem; opacity: 0.8; margin-bottom: 1rem; }
.sidebar-widget .btn { background: var(--primary-dark); border: none; color: white; border-radius: 8px; width: 100%; font-size: 0.85rem;}
.sidebar-widget .btn:hover { background: #0c2b1a; }

/* ---------------- Main Content ---------------- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Header */
.app-header {
    background: transparent;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* Search Bar */
.search-bar {
    position: relative;
    width: 350px;
}
.search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}
.search-bar input {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.9rem;
    width: 100%;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.01);
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.search-bar .shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-body);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-light);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.2s;
    cursor: pointer;
}
.icon-btn:hover { background-color: var(--bg-body); }
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    padding: 6px 16px 6px 6px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}
.user-info {
    display: flex;
    flex-direction: column;
}
.user-info .name { font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content Padding */
.app-content {
    padding: 1rem 2rem 2rem 2rem;
    flex: 1;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}
.page-title h1 { font-size: 1.75rem; font-weight: 600; margin-bottom: 0.25rem; }
.page-title p { color: var(--text-muted); margin-bottom: 0; font-size: 0.95rem; }
.header-btns { display: flex; gap: 1rem; }

/* Buttons */
.badge-count {
    background: var(--primary-green);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.btn-primary {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    border-radius: 30px;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--text-main);
    color: var(--text-main);
    border-radius: 30px;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-outline:hover { background-color: var(--bg-body); }

/* Cards Styling */
.card {
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}
.card-body { padding: 1.5rem; }

/* Dashboard Top KPI Cards Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    border-radius: var(--radius-md);
    padding: 1.5rem;
    background: var(--bg-surface);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    border: 1px solid var(--border-color);
}
.kpi-card.filled {
    background: var(--primary-green);
    color: white;
    border: none;
}
.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.kpi-title { font-size: 0.95rem; font-weight: 500; }
.kpi-card.filled .kpi-title { color: rgba(255,255,255,0.9); }
.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}
.kpi-card.filled .kpi-icon { border-color: white; color: white; background: rgba(255,255,255,0.1); }
.kpi-value { font-size: 2.5rem; font-weight: 600; line-height: 1; margin-bottom: 1rem; }
.kpi-subtitle { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.kpi-subtitle.positive { color: var(--primary-green); }
.kpi-card.filled .kpi-subtitle.positive { color: #a7f3d0; }
.kpi-subtitle svg { width: 14px; height: 14px; }

/* Tables matching theme */
.table-responsive {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: 1rem;
}
.table th {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
    background: transparent;
    padding: 1rem;
}
.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.table-striped>tbody>tr:nth-of-type(odd)>* { background-color: transparent; }
tbody tr:hover { background-color: var(--bg-body); }

/* Mobile toggler */
.mobile-toggler {
    display: none;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animated-entry { animation: fadeInUp 0.4s ease forwards; }

/* Responsive Actions */
@media (max-width: 991.98px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .search-bar { width: 250px; }
}

@media (max-width: 767.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }
    .app-main {
        margin-left: 0;
    }
    .mobile-toggler { display: block; }
    .kpi-grid { grid-template-columns: 1fr; }
    .search-bar { display: none; } /* Hide search on mobile header for space */
    .app-header { padding: 1rem; gap: 1rem; }
    .app-content { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* Premium Report UI System */
.report-premium-card { background: white; border-radius: 24px; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 10px 40px -10px rgba(0,0,0,0.04); overflow: hidden; transition: all 0.4s ease; }
.report-premium-card:hover { transform: translateY(-5px); box-shadow: 0 20px 50px -15px rgba(0,0,0,0.08); }

.ledger-header { display: none; margin-bottom: 40px; border-bottom: 2px solid #000; padding-bottom: 20px; }
.ledger-title-box h1 { font-family: 'Outfit', sans-serif; font-weight: 800; letter-spacing: -1px; }

.modern-report-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.modern-report-table th { background: #f8fafc; color: #64748b; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding: 18px 24px; border-bottom: 1px solid #e2e8f0; }
.modern-report-table td { padding: 16px 24px; font-size: 14px; color: #1e293b; border-bottom: 1px solid #f1f5f9; transition: background 0.2s ease; }
.modern-report-table tr:hover td { background: #f8fafc; }
.modern-report-table tr:last-child td { border-bottom: none; }

.report-total-bar { background: #1e293b; color: white; padding: 25px 30px; border-radius: 0 0 24px 24px; display: flex; justify-content: space-between; align-items: center; }
.report-total-bar .label { opacity: 0.6; text-transform: uppercase; font-size: 11px; letter-spacing: 2px; font-weight: 700; }
.report-total-bar .value { font-size: 24px; font-weight: 800; color: #fbbf24; }

.status-badge-pill { padding: 6px 16px; border-radius: 99px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

@media print {
    .app-sidebar, .page-header, .header-btns, .app-header, .btn, .flash-message, form, .no-print, nav { display: none !important; }
    .app-wrapper, .main-content { padding: 0 !important; margin: 0 !important; display: block !important; }
    body { background: white !important; font-family: 'Inter', sans-serif !important; color: black !important; }
    .report-premium-card { box-shadow: none !important; border: 2px solid #000 !important; border-radius: 0 !important; }
    .modern-report-table th, .modern-report-table td { border: 1px solid #000 !important; color: black !important; padding: 10px 15px !important; }
    .report-total-bar { background: #f1f5f9 !important; color: black !important; border: 2px solid #000 !important; border-top: none !important; border-radius: 0 !important; }
    .report-total-bar .value { color: black !important; }
    .ledger-header { display: block !important; }
}
