/* ============================================
   ESPACE PERSO — Components
   ============================================ */

/* ── Cards ──────────────────────────────── */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-accent {
    border-left: 4px solid var(--accent, var(--color-dashboard));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}

.card-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ── Buttons ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover { filter: brightness(0.92); }
.btn:active { transform: scale(0.97); }

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

.btn-taches   { background: var(--color-taches); color: white; }
.btn-planning { background: var(--color-planning); color: white; }
.btn-journal  { background: var(--color-journal); color: white; }
.btn-factures { background: var(--color-factures); color: white; }
.btn-budget   { background: var(--color-budget); color: white; }
.btn-surebet  { background: var(--color-surebet); color: white; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--text-light);
    filter: none;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-light);
    padding: 6px 10px;
}

.btn-ghost:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
    filter: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* ── Forms ──────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-dashboard);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row > * {
    flex: 1;
}

/* ── Badges ─────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-haute    { background: #FEE2E2; color: #DC2626; }
.badge-moyenne  { background: #FEF3C7; color: #D97706; }
.badge-basse    { background: #DCFCE7; color: #16A34A; }

.badge-payee    { background: #DCFCE7; color: #16A34A; }
.badge-impayee  { background: #FEF3C7; color: #D97706; }
.badge-en_retard { background: #FEE2E2; color: #DC2626; }

/* ── Widget Grid (Dashboard) ────────────── */

.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.widget {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget:hover {
    transform: translateY(-2px);
}

.widget-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
}

/* ── Modal ──────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ── Empty State ────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--border);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 16px;
}

/* ── Utilities ──────────────────────────── */

.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
