/* SofiaMed - Endocrinologie App Styles */
:root {
    --primary: #c0392b;
    --primary-dark: #922b21;
    --accent: #e67e22;
    --bg: #f4f6f9;
    --white: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dce1e7;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --sidebar-w: 240px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

/* ── LOGIN ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #922b21 0%, #c0392b 50%, #e67e22 100%);
}
.login-card {
    background: var(--white);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    text-align: center;
}
.login-card .logo { width: 140px; margin-bottom: 0.5rem; }
.login-card h2 { font-size: 1.1rem; color: var(--text-light); margin-bottom: 1.8rem; font-weight: 400; }

/* ── LAYOUT ── */
.app-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}
.sidebar-logo {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.sidebar-logo img { width: 110px; }
.sidebar-logo small { display: block; color: var(--text-light); font-size: 0.72rem; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 0.8rem 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 1.2rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar-nav a:hover { background: #fdf0ee; color: var(--primary); }
.sidebar-nav a.active { background: #fdf0ee; color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-nav .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 0.8rem 1.2rem 0.3rem;
}
.sidebar-nav a .icon { width: 18px; text-align: center; opacity: 0.7; }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-light);
}
.sidebar-footer strong { display: block; color: var(--text); }

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - var(--sidebar-w));
}

/* ── TOPBAR ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── CARDS ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-icon.red { background: #fdecea; }
.stat-icon.orange { background: #fef3e7; }
.stat-icon.green { background: #eafaf1; }
.stat-icon.blue { background: #eaf4fb; }
.stat-num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.82rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.04em; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], select, textarea {
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
textarea { resize: vertical; min-height: 90px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0.5rem 1.1rem;
    border: none; border-radius: 6px;
    font-size: 0.88rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #e8eaed; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-print { background: #2c3e50; color: #fff; }
.btn-print:hover { background: #1a252f; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: #f8f9fa; padding: 0.7rem 0.9rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); border-bottom: 2px solid var(--border); }
td { padding: 0.75rem 0.9rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:hover td { background: #fafafa; }
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
}
.badge-admin { background: #fdecea; color: var(--primary); }
.badge-doctor { background: #eafaf1; color: var(--success); }

/* ── ALERTS ── */
.alert {
    padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1rem;
    font-size: 0.9rem; border-left: 4px solid;
}
.alert-success { background: #eafaf1; border-color: var(--success); color: #1a6b3a; }
.alert-danger { background: #fdecea; border-color: var(--danger); color: #922b21; }
.alert-info { background: #eaf4fb; border-color: #2980b9; color: #1a5276; }

/* ── SEARCH ── */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-bar input { flex: 1; }

/* ── PRINT PREVIEW ── */
.print-preview {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

/* ── MISC ── */
.text-muted { color: var(--text-light); font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ── PRINT PAGE ── */
@media print {
    body { background: white; font-family: Arial, sans-serif; }
    .no-print { display: none !important; }
    .print-page { margin: 0; padding: 0; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid.three { grid-template-columns: 1fr; }
}
