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

:root {
    /* Fundcy Minimal Style - Light Mode */
    --bg-color: #E2E4E9;
    --surface-color: #FFFFFF;
    --border-color: #F1F2F4;
    --text-primary: #111111;
    --text-secondary: #7A7A7A;
    
    /* Sidebar */
    --sidebar-bg: #FFFFFF;
    --sidebar-text: #7A7A7A;
    --sidebar-hover: #F6F7F9;
    --sidebar-active-bg: #F6F7F9;
    --sidebar-active-text: #111111;
    
    /* Shadows */
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.04);
    
    /* Accents default to Lime Green */
    --accent: #9DDB27;
    --accent-hover: #8BCC1B;
    
    /* System */
    --danger: #FF4B4B;
    --success: #10B981;
}

/* Dark Mode Variables */
[data-mode="dark"] {
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --border-color: #2C2C2C;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    
    --sidebar-bg: #1E1E1E;
    --sidebar-text: #A0A0A0;
    --sidebar-hover: #2C2C2C;
    --sidebar-active-bg: #2C2C2C;
    --sidebar-active-text: #FFFFFF;
}

/* Accents */
[data-accent="blue"] { --accent: #2563EB; --accent-hover: #1D4ED8; }
[data-accent="green"] { --accent: #9DDB27; --accent-hover: #8BCC1B; }
[data-accent="purple"] { --accent: #7C3AED; --accent-hover: #6D28D9; }
[data-accent="orange"] { --accent: #F97316; --accent-hover: #EA580C; }
[data-accent="red"] { --accent: #EF4444; --accent-hover: #DC2626; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-color); color: var(--text-primary); transition: background 0.3s, color 0.3s; line-height: 1.5; letter-spacing: -0.01em; }

a { text-decoration: none; color: var(--accent); }
strong, b, th { font-weight: 600; }

.app-layout { display: flex; min-height: 100vh; padding: 20px; gap: 20px; }

/* Floating Sidebar */
.sidebar { width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; transition: background 0.3s; border-radius: 24px; box-shadow: var(--shadow-sm); overflow: hidden; height: calc(100vh - 40px); position: sticky; top: 20px; }
.sidebar-header { padding: 32px 24px 20px 24px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.6rem; color: var(--text-primary); letter-spacing: -0.5px; }
.brand-icon { color: var(--accent); background: var(--accent); border-radius: 8px; padding: 4px; color: white; width: 32px; height: 32px; }
.sidebar-nav { flex: 1; padding: 0 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: var(--sidebar-text); transition: all 0.2s ease; font-weight: 500; font-size: 0.95rem; border-radius: 12px; }
.nav-item:hover { color: var(--sidebar-active-text); background: var(--sidebar-hover); }
.nav-item.active { color: var(--sidebar-active-text); background: var(--sidebar-active-bg); font-weight: 500; }
.nav-item.active svg { color: var(--text-primary); }
.nav-item svg { width: 20px; height: 20px; }
.sidebar-footer { padding: 20px 16px; margin-top: auto; }
.text-danger { color: var(--danger) !important; }
.text-danger:hover { color: #FFFFFF !important; background: var(--danger); }

/* Main Wrapper */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; min-height: calc(100vh - 40px); min-width: 0; width: 100%; }
.topbar { background: transparent; padding: 10px 0 24px 0; display: flex; justify-content: space-between; align-items: center; z-index: 5; }
.page-title { font-size: 2.2rem; font-weight: 600; margin: 0; color: var(--text-primary); letter-spacing: -0.5px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; background: var(--surface-color); padding: 8px 16px; border-radius: 20px; box-shadow: var(--shadow-sm); }
.theme-toggle { background: transparent; border: none; color: var(--text-secondary); padding: 8px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-color); }
[data-mode="light"] .icon-sun { display: none; }
[data-mode="dark"] .icon-moon { display: none; }

.accent-picker { display: flex; gap: 8px; padding-left: 12px; border-left: 1px solid var(--border-color); }
.accent-dot { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; transition: 0.2s; opacity: 0.4; }
.accent-dot:hover, .accent-dot.active { transform: scale(1.2); opacity: 1; border: 2px solid var(--surface-color); box-shadow: 0 0 0 1px var(--text-secondary); }

.content-area { flex: 1; animation: pageEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; min-width: 0; width: 100%; }
.content-area.leaving { animation: pageLeave 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes pageEnter {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: none; }
}
@keyframes pageLeave {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateY(-15px); }
}

/* Cards & Components */
.card { background: var(--surface-color); border: none; border-radius: 24px; padding: 32px; box-shadow: var(--shadow-sm); margin-bottom: 24px; transition: all 0.3s ease; max-width: 100%; overflow-x: hidden; }
.btn { display: inline-flex; align-items: center; justify-content: center; background: var(--text-primary); color: var(--surface-color); border: none; padding: 14px 28px; border-radius: 14px; font-weight: 500; font-size: 1rem; cursor: pointer; transition: all 0.2s ease; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
.btn-secondary { background: var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background: #E2E4E9; color: var(--text-primary); transform: none; box-shadow: none; }
.btn-accent { background: var(--accent); color: #ffffff !important; }
.btn-accent:hover { background: var(--accent-hover); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.btn-outline-accent { background: transparent; color: var(--accent); border: 2px solid var(--accent); padding: 12px 26px; }
.btn-outline-accent:hover { background: var(--accent); color: #ffffff; box-shadow: 0 6px 15px rgba(0,0,0,0.1); }

.form-group { margin-bottom: 24px; }
.form-label { display: block; font-weight: 500; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-secondary); }
.form-control { width: 100%; min-width: 0; padding: 14px 18px; border: 2px solid transparent; border-radius: 12px; background: var(--bg-color); color: var(--text-primary); outline: none; transition: all 0.2s ease; font-size: 1rem; font-family: inherit; -webkit-appearance: none; box-sizing: border-box; }
.form-control:focus { border-color: var(--accent); background: var(--surface-color); box-shadow: 0 0 12px rgba(157, 219, 39, 0.25); }
.form-control-sm { padding: 10px 14px; font-size: 0.9rem; border-radius: 10px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A7A7A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* Filter Grids */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 24px; align-items: end; }
.filter-item { display: flex; flex-direction: column; gap: 8px; }
.filter-item label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.filter-item .form-control { padding: 10px 14px; font-size: 0.95rem; }
.filter-actions { display: flex; gap: 12px; align-items: stretch; }
.filter-actions .btn { padding: 10px 18px; font-size: 0.95rem; }

.alert { padding: 16px 20px; border-radius: 14px; margin-bottom: 24px; font-weight: 500; font-size: 0.95rem; border: none; display: flex; align-items: center; gap: 12px; }
.alert-success { background: rgba(157, 219, 39, 0.15); color: #5B8214; }
[data-mode="dark"] .alert-success { color: var(--accent); }
.alert-error { background: rgba(255, 75, 75, 0.15); color: var(--danger); }

/* Table */
.table-responsive { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border-color); background: var(--surface-color); width: 100%; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 16px 24px; border-bottom: 1px solid var(--border-color); min-width: 120px; white-space: nowrap; }
.table th:nth-child(2), .table td:nth-child(2) { min-width: 150px; }
.table th { font-weight: 500; color: var(--text-secondary); font-size: 0.85rem; background: var(--surface-color); border-bottom: 1px solid var(--border-color); }
.table tr { transition: all 0.2s; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-color); }

/* Loader */
.loader-overlay { position: fixed; inset: 0; background: rgba(226, 228, 233, 0.7); z-index: 9999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
[data-mode="dark"] .loader-overlay { background: rgba(18, 18, 18, 0.8); }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--border-color); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile Response (Bottom Navigation) */
@media (max-width: 900px) {
    .app-layout { flex-direction: column; padding: 12px; padding-bottom: 80px; gap: 12px; }
    
    /* Topbar */
    .topbar { padding: 12px 16px; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: nowrap; overflow-x: auto; gap: 8px; }
    .page-title { font-size: 1.4rem; white-space: nowrap; }
    .topbar-actions { padding: 6px 12px; width: auto; gap: 8px; flex-shrink: 0; }
    .accent-picker { padding-left: 8px; gap: 6px; }
    .accent-dot { width: 16px; height: 16px; }

    /* Generic Layout Resets */
    .grid-2-col, [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; gap: 16px !important; }
    [style*="display:flex; justify-content:space-between; align-items:center"] { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; }
    [style*="display:flex; justify-content:space-between; align-items:center"] form { flex-direction: column !important; align-items: stretch !important; width: 100%; }
    [style*="width: 220px"] { width: 100% !important; }
    
    /* Fixed Bottom Nav (Instagram Style) */
    .sidebar { width: 100%; height: 64px; position: fixed; top: auto; bottom: 0; left: 0; right: 0; flex-direction: row; align-items: center; justify-content: space-around; padding: 0 8px; border-radius: 24px 24px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,0.06); overflow: visible; z-index: 100; border-top: 1px solid var(--border-color); background: var(--surface-color); }
    
    .sidebar-header { display: none; } /* Hide logo on mobile */
    
    .sidebar-nav { display: flex; flex-direction: row; gap: 0; overflow-x: auto; padding: 0; flex: 1; justify-content: space-evenly; align-items: center; -ms-overflow-style: none; scrollbar-width: none; height: 100%; }
    .sidebar-nav::-webkit-scrollbar { display: none; }
    
    /* Icon-only tabs */
    .nav-item { padding: 8px; white-space: nowrap; font-size: 0; gap: 0; flex-direction: column; border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: transparent !important; }
    .nav-item svg { width: 22px; height: 22px; }
    
    /* Active State for Mobile */
    .nav-item.active { background: transparent !important; }
    .nav-item.active svg { color: var(--accent); transform: scale(1.15); transition: transform 0.2s ease; }
    
    .sidebar-footer { padding: 0; margin: 0; display: flex; align-items: center; }
    .sidebar-footer .nav-item { font-size: 0; gap: 0; padding: 8px; }
    
    .summary-flex { flex-direction: column !important; align-items: stretch !important; gap: 16px !important; }
    .summary-flex > div { width: 100% !important; }
    .card { padding: 20px; }
    
    .filter-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .filter-item label { font-size: 0.8rem; }
    .filter-item:nth-child(5), .filter-item:nth-child(6), .filter-actions { grid-column: span 2; }
    .filter-actions { flex-direction: row !important; }
    .filter-actions .btn { flex: 1; justify-content: center; }
    
    .form-grid { grid-template-columns: 1fr; }
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.summary-flex { display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px solid var(--border-color); padding-top: 16px; gap: 24px; }

/* Modal Styles */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; display: none; justify-content: center; align-items: center; padding: 20px; opacity: 0; transition: opacity 0.3s; }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s forwards; }
.modal-content { background: var(--surface-color); border-radius: 24px; padding: 32px; width: 100%; max-width: 500px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); transform: translateY(20px); animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.modal-close { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); transition: color 0.2s; }
.modal-close:hover { color: var(--danger); }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideUp { to { transform: translateY(0); } }

