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

:root {
    --bg-main: #f4f7fe;
    --bg-sidebar: #111827; /* Dark Drive Sidebar */
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-sidebar: #9ca3af;
    --text-sidebar-hover: #ffffff;
    --border-color: #e5e7eb;
    
    /* Brand Colors matching the image */
    --accent-blue: #4f46e5;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;

    --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);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon { color: var(--accent-yellow); font-size: 1.2rem; }

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
    overflow-y: auto;
}

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }

.nav-link-3c {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.nav-link-3c i { font-size: 1.1rem; width: 20px; text-align: center; }

.nav-link-3c:hover, .nav-link-3c.active {
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar-hover);
}

.nav-link-3c.active { border-left: 4px solid var(--accent-blue); padding-left: calc(1rem - 4px); }

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-main);
}

/* Top Header */
.top-header {
    padding: 1.5rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.search-bar {
    background: #fff;
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 350px;
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    color: var(--text-secondary);
    font-size: 1.2rem;
    text-decoration: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e0e7ff;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    overflow: hidden;
}

/* Content Area */
.content-area { padding: 0 2.5rem 3rem; }

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2.5rem;
}

/* Welcome Banner */
.welcome-banner {
    background: #eef2ff;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.welcome-banner .banner-content {
    max-width: 65%;
    position: relative;
    z-index: 2;
}

.welcome-banner h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e1b4b;
    margin: 0 0 0.75rem 0;
}

.welcome-banner p {
    color: #4338ca;
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.banner-image {
    position: absolute;
    right: 3rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.2;
    font-size: 8rem;
    color: var(--accent-blue);
}

/* Folder Cards (Caisses) */
.caisses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.caisse-card {
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    color: #fff;
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    transition: transform 0.2s ease;
}

.caisse-card:hover { transform: translateY(-5px); }

.caisse-red { background: var(--accent-red); box-shadow: 0 10px 20px -5px rgba(239, 68, 68, 0.4); }
.caisse-blue { background: var(--accent-blue); box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4); }
.caisse-yellow { background: var(--accent-yellow); box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.4); }

.caisse-card .card-icon {
    background: rgba(255,255,255,0.25);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.caisse-card .card-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 1.25rem 0 0.5rem;
    opacity: 0.9;
}

.caisse-card .card-info .amount {
    font-size: 1.75rem;
    font-weight: 700;
}

/* White Cards (Glass Card equivalent for light theme) */
.glass-card, .white-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.form-card { max-width: 700px; margin: 0 auto; }

/* Headings */
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.page-subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.95rem; }

/* Buttons */
.btn-3c {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-primary-3c { background: var(--accent-blue); color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); }
.btn-primary-3c:hover { background: #4338ca; color: #fff; transform: translateY(-1px); }

.btn-success-3c { background: var(--accent-green); color: #fff; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }
.btn-warning-3c { background: var(--accent-yellow); color: #fff; box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3); }
.btn-danger-3c { background: var(--accent-red); color: #fff; }
.btn-ghost-3c { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-ghost-3c:hover { background: #f3f4f6; color: var(--text-primary); }

.btn-lg-3c { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* Forms */
.form-label-3c {
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); 
    margin-bottom: 0.5rem; display: block;
}

.form-control-3c, .form-select-3c {
    width: 100%;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-control-3c:focus, .form-select-3c:focus {
    border-color: var(--accent-blue);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Tables (Recent Files) */
.table-responsive { overflow-x: auto; }
.table-3c { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-3c th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table-3c td {
    padding: 1.1rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-weight: 500;
}
.table-3c tr:last-child td { border-bottom: none; }
.table-3c tr:hover td { background: #f8fafc; }

.table-3c .amount-cell { font-weight: 700; font-variant-numeric: tabular-nums; }
.table-3c .amount-cell.positive { color: var(--accent-green); }
.table-3c .amount-cell.negative { color: var(--accent-red); }

/* Badges */
.badge-caisse { display: inline-flex; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
.badge-c1 { background: #e0e7ff; color: var(--accent-blue); }
.badge-c2 { background: #d1fae5; color: var(--accent-green); }
.badge-c3 { background: #fef3c7; color: var(--accent-yellow); }

.badge-type { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.badge-encaissement { background: #d1fae5; color: #047857; }
.badge-depense { background: #fee2e2; color: #b91c1c; }
.badge-transfert { background: #ede9fe; color: #6d28d9; }
.badge-retrait { background: #fef3c7; color: #b45309; }

.date-cell { font-size: 0.85rem; color: var(--text-muted); }

/* Alerts */
.alert-3c { border-radius: var(--radius-md); padding: 1rem 1.25rem; font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 10px; margin-bottom: 1.5rem; }
.alert-success-3c { background: #d1fae5; color: #047857; }
.alert-danger-3c { background: #fee2e2; color: #b91c1c; }
.alert-warning-3c { background: #fef3c7; color: #b45309; }

/* Right Sidebar Widgets */
.widget-list { display: flex; flex-direction: column; gap: 1rem; }
.widget-item {
    display: flex; align-items: center; gap: 12px;
    padding: 1rem; border-radius: var(--radius-md);
    background: #f9fafb; border: 1px solid var(--border-color);
}
.widget-item-icon {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.widget-info h4 { margin: 0 0 0.2rem; font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.widget-info p { margin: 0; font-size: 0.8rem; color: var(--text-secondary); }

/* Quick Actions */
.quick-action-list { display: flex; flex-direction: column; gap: 0.75rem; }
.quick-action-btn {
    display: flex; align-items: center; gap: 12px;
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    color: var(--text-primary); text-decoration: none; font-weight: 500;
    transition: background 0.2s;
}
.quick-action-btn:hover { background: #f3f4f6; }
.qa-icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}

/* Mobile & Menu toggle */
.menu-toggle {
    background: transparent; border: none; font-size: 1.5rem; color: var(--text-primary); cursor: pointer; padding: 0.5rem;
}
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .caisses-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991px) {
    .sidebar {
        position: fixed; left: -260px; top: 0; bottom: 0;
    }
    .sidebar.show { transform: translateX(260px); }
    .sidebar-overlay.show { display: block; }
    .top-header { padding: 1rem 1.5rem; }
    .content-area { padding: 0 1.5rem 2rem; }
    .search-bar { width: 250px; }
}

@media (max-width: 768px) {
    .caisses-grid { grid-template-columns: 1fr; }
    .welcome-banner { flex-direction: column; text-align: center; padding: 1.5rem; }
    .welcome-banner .banner-content { max-width: 100%; }
    .banner-image { display: none; }
}

/* Fix for previous login styles */
.login-card { margin: 10vh auto; }
.login-logo { text-align: center; margin-bottom: 2rem; color: var(--accent-blue); font-size: 3rem; }
.login-logo h1 { font-size: 1.5rem; color: var(--text-primary); margin-top: 1rem; }
