/**
 * MedFlow — Layout & Structure
 * Reset, grille, topbar, navigation, page
 */

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-weight: 400;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Topbar ── */
.topbar {
    background: var(--navy);
    padding: 0 var(--space-8);
    display: flex;
    align-items: center;
    height: 52px;
    gap: var(--space-8);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.brand-icon {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    color: #fff;
    letter-spacing: 0.02em;
}

.brand-name span {
    font-style: italic;
    color: #93C5FD;
}

/* ── Navigation topbar ── */
.topnav {
    display: flex;
    gap: 2px;
    flex: 1;
}

.nav-item {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 400;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    border: none;
    background: none;
    transition: all var(--duration);
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.nav-item:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
}

.nav-item.active {
    color: #fff;
    background: rgba(255,255,255,0.14);
    font-weight: 500;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0.7;
}

/* ── Topbar droite ── */
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-shrink: 0;
}

.alert-pill {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: rgba(192,57,43,0.25);
    border: 1px solid rgba(192,57,43,0.5);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    color: #FCA5A5;
    cursor: pointer;
    transition: background var(--duration);
}

.alert-pill:hover {
    background: rgba(192,57,43,0.35);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #4ADE80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.clock {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.45);
}

.user-badge {
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.6);
    padding: var(--space-1) var(--space-3);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
}

/* ── Page container ── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

/* ── Page header ── */
.page-header {
    margin-bottom: var(--space-8);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: var(--space-5);
    border-bottom: 1.5px solid var(--border);
}

.page-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 400;
    line-height: 1.1;
    color: var(--navy);
}

.page-title em {
    font-style: italic;
    color: var(--blue);
}

.page-subtitle {
    font-size: var(--text-xs);
    color: var(--ink-3);
    margin-top: var(--space-1);
}

.page-meta {
    font-size: var(--text-xs);
    color: var(--ink-3);
    text-align: right;
    line-height: 1.7;
}

/* ── Grilles ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

/* ── Animations ── */
.fade-up {
    animation: fadeUp var(--duration-lg) var(--ease-out);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }

    .topbar { padding: 0 var(--space-4); gap: var(--space-4); }
    .topnav { display: none; }
    .page { padding: var(--space-5) var(--space-4); }
    .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
    .page-title { font-size: var(--text-xl); }
}

/* ── Navigation mobile ── */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--navy);
    padding: var(--space-2) 0;
    z-index: var(--z-sticky);
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-3);
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    border: none;
    background: none;
    cursor: pointer;
}

.mobile-nav-item.active { color: #fff; }
.mobile-nav-item .nav-icon { font-size: 18px; }

@media (max-width: 700px) {
    .mobile-nav { display: flex; }
    body { padding-bottom: 60px; }
}
