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

:root {
    --primary:   #2a5c8a;
    --accent:    #e8a020;
    --light:     #f4f7fb;
    --text:      #1e2d3d;
    --muted:     #6b7f93;
    --border:    #d0dce8;
    --white:     #ffffff;
    --success:   #2e7d32;
    --danger:    #c0392b;
    --warning:   #b7770d;

    --zaal:      #2a5c8a;
    --butsuma:   #7b3fa0;
    --vergader:  #1a7a5e;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    background: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ── NAVBAR ─────────────────────────────────────────────────────────── */
.navbar {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 54px;
    gap: 1.5rem;
}
.nav-brand {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.nav-logo { font-size: 1.3rem; color: var(--accent); }
.navbar ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
    flex: 1;
}
.navbar ul a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.navbar ul a:hover,
.navbar ul a.active { background: rgba(255,255,255,0.15); color: white; }
.nav-user { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }
.user-name { color: rgba(255,255,255,0.75); font-size: 0.85rem; }
.btn-logout {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ── FLASH MESSAGES ──────────────────────────────────────────────────── */
.flash-container { max-width: 1200px; margin: 1rem auto; padding: 0 1.5rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.flash-success { background: #d4edda; color: var(--success); border: 1px solid #b8dbbe; }
.flash-danger  { background: #fde8e8; color: var(--danger);  border: 1px solid #f5bcbc; }
.flash-warning { background: #fff3cd; color: var(--warning); border: 1px solid #ffe08a; }

/* ── PAGE HEADER ─────────────────────────────────────────────────────── */
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0 1rem;
}
.page-title { font-size: 1.6rem; color: var(--primary); font-weight: 700; }

/* ── CONTAINER ───────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ── BUTTONS ─────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary.btn-full { width: 100%; text-align: center; padding: 0.75rem; }

.btn-secondary {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-danger-sm {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-danger-sm:hover { background: var(--danger); color: white; }

/* ── FORMS ───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.form-group input,
.form-group select {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--primary); }
.form-group-check { justify-content: flex-end; }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── LOGIN PAGE ──────────────────────────────────────────────────────── */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #1a3d5c 100%);
}
.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
}
.login-logo { font-size: 3rem; color: var(--accent); margin-bottom: 0.5rem; }
.login-card h1 { font-size: 1.4rem; color: var(--primary); margin-bottom: 0.25rem; }
.login-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.5rem; }
.login-form { text-align: left; }

.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: white;
    color: #1e2d3d;
    border: 1px solid #d0dce8;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    width: 100%;
    margin-top: 0.5rem;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.btn-microsoft:hover { background: #f4f7fb; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

.btn-secondary-sm {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary-sm:hover { background: var(--primary); color: white; }

.action-cell { display: flex; gap: 0.4rem; align-items: center; }
.admin-note { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }

/* ── ROOM TABS ───────────────────────────────────────────────────────── */
.room-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
}
.room-tab {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    transition: all 0.15s;
    color: var(--muted);
    background: white;
    border-color: var(--border);
}
.room-tab.active, .room-tab:hover { color: white; border-color: transparent; }
.room-tab-zaal.active,      .room-tab-zaal:hover      { background: var(--zaal); }
.room-tab-butsuma.active,   .room-tab-butsuma:hover   { background: var(--butsuma); }
.room-tab-vergaderzaal.active, .room-tab-vergaderzaal:hover { background: var(--vergader); }

/* ── WEEK NAV ────────────────────────────────────────────────────────── */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}
.week-label { font-weight: 600; color: var(--primary); }
.btn-week {
    background: white;
    border: 1px solid var(--border);
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--primary);
    font-size: 0.85rem;
    transition: background 0.15s;
}
.btn-week:hover { background: var(--light); }

/* ── CALENDAR TABLE ──────────────────────────────────────────────────── */
.kalender-container { padding-bottom: 3rem; }
.cal-scroll { overflow-x: auto; }
.cal-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    min-width: 700px;
}
.cal-table thead th {
    background: var(--primary);
    color: white;
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.85rem;
}
.cal-table thead th.today { background: #1a3d5c; }
.time-col { width: 52px; }
.day-name { font-size: 0.75rem; opacity: 0.8; text-transform: uppercase; }
.day-num {
    font-size: 1.1rem;
    font-weight: 700;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: 50%;
}
.today-circle { background: var(--accent); }

.time-cell {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: right;
    padding: 0 6px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: top;
}
.cal-table tr { border-bottom: 1px solid var(--border); }
.cal-table tr:last-child { border-bottom: none; }

.free-cell {
    padding: 1px;
    text-align: center;
    vertical-align: top;
    height: 22px;
}
.free-slot {
    display: block;
    width: 100%;
    height: 100%;
    color: transparent;
    font-size: 0;
    transition: background 0.1s;
    border-radius: 2px;
}
.free-slot:hover {
    background: rgba(42, 92, 138, 0.12);
    color: var(--primary);
    font-size: 0.9rem;
}

.booking-cell {
    background: var(--primary);
    padding: 4px 6px;
    vertical-align: top;
    border-radius: 4px;
}
.booking-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: white;
    font-size: 0.72rem;
    line-height: 1.3;
}
.booking-by { opacity: 0.75; font-style: italic; }

.past-cell { background: #f9f9f9; }
.past-row td { opacity: 0.5; }

.cal-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--muted);
    flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-free-box   { width: 14px; height: 14px; border-radius: 3px; background: #e8f0fa; border: 1px dashed var(--primary); display: inline-block; }
.legend-booked-box { width: 14px; height: 14px; border-radius: 3px; background: var(--primary); display: inline-block; }
.legend-past-box   { width: 14px; height: 14px; border-radius: 3px; background: #f0f0f0; display: inline-block; }

.day-head { text-align: center; }
.day-name { font-size: 0.7rem; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.05em; }
.day-num { font-size: 0.85rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 4px; display: inline-block; }
.today-head { background: #1a3d5c; }
.today-circle { background: var(--accent); color: white; }

.hour-row { border-top: 1px solid var(--border); }
.slot-row { height: 22px; }
.bk-time { font-size: 0.68rem; opacity: 0.85; }

/* ── RESERVEER FORM ──────────────────────────────────────────────────── */
.form-container { padding: 2rem 1.5rem; display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }
.form-card { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.reserveer-form .form-group { margin-bottom: 1.25rem; }

.room-info-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.room-info-card {
    background: white;
    border-radius: 8px;
    padding: 0.9rem 1rem;
    border-left: 4px solid;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.room-info-card h3 { font-size: 0.9rem; margin-bottom: 0.15rem; }
.room-info-card p { font-size: 0.8rem; color: var(--muted); }
.room-cat-zaal      { border-color: var(--zaal);    }
.room-cat-butsuma   { border-color: var(--butsuma); }
.room-cat-vergaderzaal { border-color: var(--vergader); }

/* ── DATA TABLE ──────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}
.data-table th {
    background: var(--primary);
    color: white;
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.85rem;
}
.data-table td { padding: 0.6rem 0.9rem; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--light); }

.room-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: white;
}
.room-badge-zaal       { background: var(--zaal); }
.room-badge-butsuma    { background: var(--butsuma); }
.room-badge-vergaderzaal { background: var(--vergader); }

.badge-admin {
    background: var(--accent);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.past-label { font-size: 0.8rem; color: var(--muted); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state p { font-size: 1.05rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ── ADMIN ───────────────────────────────────────────────────────────── */
.admin-section { margin: 2rem 0; }
.admin-section h2 { font-size: 1.15rem; color: var(--primary); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.inline-form .form-row { align-items: flex-end; }

/* ── FOOTER ──────────────────────────────────────────────────────────── */
footer {
    background: var(--primary);
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    margin-top: auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav-brand { font-size: 0.9rem; }
    .navbar ul { display: none; }
    .form-container { grid-template-columns: 1fr; }
    .room-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
    .week-nav { flex-direction: column; align-items: flex-start; }
}
