/* DailyTurf — Theme turf moderne */
:root {
    --bg: #0f1419;
    --bg-2: #161d26;
    --bg-3: #1d2731;
    --surface: #1a232e;
    --border: #2a3645;
    --text: #e7ecf0;
    --text-muted: #8b97a7;
    --primary: #10b981;
    --primary-2: #059669;
    --primary-soft: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --info: #3b82f6;
    --info-soft: rgba(59, 130, 246, 0.12);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============ LOGIN ============ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.15), transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.1), transparent 50%),
                var(--bg);
    padding: 20px;
}
.login-wrap {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 40px;
    align-items: start;
}
.login-info {
    color: var(--text);
    padding: 12px 0;
}
.login-info h2 {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-info .lead {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 24px;
}
.login-info .features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
.login-info .feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.login-info .feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.login-info .feature h3 {
    margin: 0 0 6px;
    font-size: 14.5px;
    font-weight: 600;
}
.login-info .feature p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}
.login-info .why-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.login-info .why-block h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}
.login-info .why-block p {
    margin: 0 0 10px;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-muted);
}
.login-info .why-block p:last-child { margin-bottom: 0; }
.login-info .benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: grid;
    gap: 10px;
}
.login-info .benefits li {
    padding: 12px 14px;
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-muted);
    border-left: 3px solid var(--primary);
}
.login-info .benefits strong { color: var(--text); }
.login-info .footer-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    margin: 0;
    padding: 16px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}
.logo {
    text-align: center;
    margin-bottom: 28px;
}
.logo h1 {
    margin: 12px 0 4px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.logo p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}
.login-form .field { margin-bottom: 16px; }
.login-hint {
    margin-top: 20px;
    padding: 12px;
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    text-align: center;
    color: var(--text-muted);
}

/* ============ APP LAYOUT ============ */
.app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.sidebar-close:hover { background: var(--bg-3); }

.nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all 0.15s;
}
.nav-item:hover {
    background: var(--bg-3);
    color: var(--text);
}
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.user-name { font-size: 13.5px; font-weight: 600; }
.user-email { font-size: 12px; color: var(--text-muted); }
.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    transition: 0.15s;
}
.logout-btn:hover { background: var(--bg-3); color: var(--danger); }

.main {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}
.topbar {
    height: 64px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.menu-btn:hover { background: var(--bg-3); }
.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.date-today { color: var(--text-muted); font-size: 13.5px; }

.content { padding: 24px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ============ KPIs ============ */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-primary .kpi-icon { background: var(--primary); color: #fff; }
.kpi-label { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.kpi-value.pos { color: var(--primary); }
.kpi-value.neg { color: var(--danger); }

.kpis-mini { grid-template-columns: repeat(4, 1fr); }
.kpi-mini {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-mini span { color: var(--text-muted); font-size: 12.5px; }
.kpi-mini strong { font-size: 19px; font-weight: 700; }
.kpi-mini strong.pos { color: var(--primary); }
.kpi-mini strong.neg { color: var(--danger); }

/* ============ CARDS ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.card-body { padding: 20px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ============ TABLES ============ */
.table-wrap {
    overflow-x: auto;
    margin: -20px;
    padding: 0 20px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table thead th {
    text-align: left;
    padding: 12px 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-3); }
.table-mini tbody td, .table-mini thead th { padding: 8px 10px; }

.muted { color: var(--text-muted); text-align: center; padding: 24px !important; }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-gagne { background: var(--primary-soft); color: var(--primary); }
.badge-perdu { background: var(--danger-soft); color: var(--danger); }
.badge-en_cours { background: var(--warning-soft); color: var(--warning); }
.badge-depot { background: var(--primary-soft); color: var(--primary); }
.badge-retrait { background: var(--info-soft); color: var(--info); }

.amount-pos { color: var(--primary); font-weight: 600; }
.amount-neg { color: var(--danger); font-weight: 600; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--bg-3);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-secondary { background: var(--bg-3); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-icon {
    padding: 6px;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
}
.btn-icon:hover { background: var(--bg-3); color: var(--text); transform: none; }
.btn-block { width: 100%; justify-content: center; }

/* ============ FORMS ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.input, .field input, .field select, .field textarea {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    border-color: var(--primary);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filters .input { min-width: 140px; }

.page-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 20px;
}
.field-wide { grid-column: 1 / -1; }

/* ============ MODALS ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.show { display: flex; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.modal-dialog {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.alert-success { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary); }

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    box-shadow: var(--shadow);
    z-index: 300;
    animation: slideUp 0.25s;
}
.toast.success { border-left: 4px solid var(--primary); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============ SETTINGS ============ */
.settings-group {
    margin-bottom: 24px;
}
.settings-group h4 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .kpis-mini { grid-template-columns: repeat(2, 1fr); }
    .login-wrap { grid-template-columns: 1fr; max-width: 560px; }
    .login-info { order: 2; }
    .login-card { order: 1; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s;
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
    .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
    .main { margin-left: 0; }
    .menu-btn { display: block; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .date-today { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 18px; }
}

@media (max-width: 480px) {
    .kpis, .kpis-mini { grid-template-columns: 1fr 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .filters .input { width: 100%; }
    .login-info .features-grid { grid-template-columns: 1fr; }
    .login-info h2 { font-size: 22px; }
}
