/* assets/style.css – EasyCalendar */

:root {
    --bg:       #0f1117;
    --surface:  #1a1d27;
    --surface2: #22263a;
    --border:   #2e3250;
    --text:     #e8eaf6;
    --muted:    #8892b0;
    --primary:  #5c7cfa;
    --primary-h:#4568e8;
    --danger:   #e05c6d;
    --success:  #43c98c;
    --warning:  #f0a84e;
    --radius:   10px;
    --shadow:   0 4px 24px rgba(0,0,0,.45);
}

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

html { font-size: 16px; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-h); text-decoration: none; }
.btn-outline  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface2); text-decoration: none; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover { background: #c84b5b; text-decoration: none; }
.btn-success  { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-block    { width: 100%; justify-content: center; padding: .6rem; font-size: 1rem; }
.btn-sm       { padding: .3rem .75rem; font-size: .8rem; }

/* ── FORMS ───────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.form-group label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.form-row { display: flex; gap: 1rem; }

input[type=text],
input[type=password],
input[type=email],
input[type=date],
select,
textarea {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .5rem .75rem;
    font-size: .9rem;
    width: 100%;
    transition: border-color .15s;
}
input[type=date]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(.5);
    cursor: pointer;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.input-readonly { background: var(--bg); cursor: default; color: var(--muted); }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
    align-self: flex-end;
    padding-bottom: .5rem;
}
.checkbox-label input { width: auto; }

/* ── STICKY TOP BAR (navbar + week-nav together) ─── */
#sticky-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Push page content below the fixed bar */
body.calendar-page {
    padding-top: var(--sticky-top-h, 106px);
}

/* ── NAVBAR ──────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
    letter-spacing: -.01em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--muted);
}
.nav-user small { font-size: .75rem; }
.group-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── ALERTS / FLASH ──────────────────────────────── */
.alert, .flash {
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    margin: .75rem 1.5rem;
    font-size: .9rem;
    font-weight: 500;
    border-left: 4px solid;
}
.alert-error, .flash-error   { background: #2e1520; border-color: var(--danger);  color: #f8a0aa; }
.alert-success,.flash-success { background: #112a20; border-color: var(--success); color: #7ce8b8; }
.flash-warning                { background: #2a1e08; border-color: var(--warning); color: #f5c87a; }

/* ── LOGIN PAGE ──────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 60% 40%, #1a2040 0%, var(--bg) 70%);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.login-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-logo {
    text-align: center;
}
.logo-icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; }
.login-logo p  { color: var(--muted); font-size: .875rem; margin-top: .25rem; }

/* ── WEEK NAV ────────────────────────────────────── */
.week-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.week-label {
    font-weight: 700;
    font-size: 1.05rem;
    flex: 1;
    text-align: center;
}
.badge-today {
    background: var(--primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 99px;
    margin-left: .6rem;
    vertical-align: middle;
}

/* ── ROOM TABS ───────────────────────────────────── */
.room-tabs {
    display: flex;
    gap: .4rem;
    align-items: center;
}
.room-tab {
    padding: .35rem 1.1rem;
    border-radius: 99px;
    font-weight: 700;
    font-size: .88rem;
    color: var(--muted);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.room-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.room-tab:hover:not(.active) {
    background: var(--surface2);
    color: var(--text);
    text-decoration: none;
}

/* ── CALENDAR ────────────────────────────────────── */

/* Day-header row lives inside #sticky-top — no sticky tricks needed */
.cal-header {
    display: flex;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    border-top: 1px solid var(--border);
    overflow: hidden; /* clips when table scrolls horizontally */
}
.cal-header-time {
    flex: 0 0 72px;   /* initial guess — overwritten by JS syncHeader() */
    min-width: 72px;
    padding: .6rem .6rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: right;
    border-right: 1px solid var(--border);
}
.cal-header-day {
    flex: 1;
    padding: .5rem .4rem;
    text-align: center;
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-right: 1px solid var(--border);
}
.cal-header-day:last-child { border-right: none; }
.cal-header-day.today-col  { background: #1c2040; color: var(--primary); }

.calendar-outer {
    overflow-x: auto;
}
.calendar-wrap {
    padding: 0 0 2rem;
    min-width: 700px;
}
.calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
/* No thead — header is in #sticky-top as .cal-header */
.day-name { display: block; font-size: .9rem; }
.day-num  {
    display: inline-block;
    width: 32px; height: 32px;
    line-height: 32px;
    border-radius: 50%;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-top: .25rem;
}
.today-badge {
    background: var(--primary);
    color: #fff;
}
.time-col { width: 72px; min-width: 72px; }
col.col-time { width: 72px; }

.time-label {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 1rem;
    text-align: right;
    padding: 0 .7rem;
    vertical-align: top;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 32px;
}
.half-mark { color: var(--border); }

.hour-row td { height: 32px; }
.half-row td { height: 26px; }

.hour-row .time-label { border-top-color: var(--border); }
.half-row .time-label { border-top-color: transparent; }

.empty-cell {
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
    user-select: none;
}
.empty-cell:hover       { background: var(--surface2); }
.empty-cell.drag-highlight { background: #2a3a6a; border-color: var(--primary); }
.past-cell  { background: #13151e; cursor: default; }
.past-cell:hover { background: #13151e; }

/* ── DAY PANELS (split / solo) ───────────────────── */
.booked-cell {
    border: 1px solid var(--border);
    vertical-align: top;
    padding: 0;
}

/* ── ROOM COLUMN DIVIDER ─────────────────────────── */
/* Between the two room <td>s inside a day, add a visible divider */
.empty-cell.room-col-r,
.booked-cell.room-col-r,
.past-cell.room-col-r {
    border-left-color: var(--surface2);
}

/* ── ROOM SUB-LABELS in day header ───────────────── */
.room-sublabels {
    display: flex;
    gap: 0;
    margin-top: .25rem;
    border-top: 1px solid var(--border);
}
.room-sublabel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
    padding: .25rem .2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .85;
}
.room-sublabel + .room-sublabel {
    border-left: 1px solid var(--border);
}
.room-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .02em;
}
.closed-cell {
    background: repeating-linear-gradient(
        135deg,
        #1a1420 0px, #1a1420 8px,
        #110e17 8px, #110e17 16px
    );
    border: 1px solid #3a2a4a;
    vertical-align: middle;
    text-align: center;
    cursor: default;
}
.closed-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: #9a7ab0;
    font-size: .85rem;
    padding: 1rem .5rem;
    height: 100%;
}
.closed-block strong { color: #c49fdd; font-size: .95rem; }
.cal-header-day.closed-col {
    background: #1a1420;
    color: #9a7ab0;
}
.cal-header-day.closed-col .day-name,
.cal-header-day.closed-col .day-num { opacity: .55; }
.closed-badge {
    display: block;
    font-size: .7rem;
    color: #c49fdd;
    font-weight: 600;
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── BOOKING BLOCK ───────────────────────────────── */
.booking-block {
    padding: .4rem .5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    font-size: .78rem;
    overflow: hidden;
    border-radius: 4px;
    position: relative;
}
.booking-block strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-block span   { color: var(--muted); font-size: .75rem; }
.booking-block em     { color: var(--text); font-size: .8rem; font-style: normal; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-block small  { color: var(--muted); font-size: .75rem; }

.btn-del {
    position: absolute;
    top: .25rem; right: .25rem;
    background: rgba(0,0,0,.35);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 18px; height: 18px;
    font-size: .65rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity .15s;
    padding: 0;
}
.booking-block:hover .btn-del { opacity: 1; }

/* ── PENDING BOOKINGS ────────────────────────────── */
.pending-cell { opacity: .85; }
.booking-pending {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 6px,
        rgba(255,255,255,.04) 6px,
        rgba(255,255,255,.04) 12px
    ) !important;
    border-left-style: dashed !important;
}
.pending-label {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(251,191,36,.12);
    border: 1px solid rgba(251,191,36,.35);
    border-radius: 3px;
    padding: 0 .35rem;
    margin-bottom: .1rem;
    letter-spacing: .03em;
}
.pending-icon { font-size: .8rem; }
.btn-del:hover { background: var(--danger); }
.btn-del-series {
    top: .25rem; right: 1.75rem; /* sits left of the single-delete button */
    font-size: .55rem;
    width: 24px;
}

/* ── RECURRENCE ──────────────────────────────────── */
.recurrence-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem 1rem;
}
.recur-hint {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .5rem;
    line-height: 1.4;
}
.recur-icon { font-size: .7rem; vertical-align: middle; margin-right: .15rem; }

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
    backdrop-filter: blur(3px);
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: .2rem .4rem;
    border-radius: 4px;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-box form {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding-top: .5rem;
}

/* ── ADMIN ───────────────────────────────────────── */
.admin-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -.02em;
}
.admin-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    overflow: hidden;
}
.empty-state {
    padding: 1.25rem;
    color: var(--muted);
    font-style: italic;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
}
.section-header h2 { font-size: 1rem; font-weight: 700; }

.inline-form {
    padding: .75rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.form-inline-row {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    flex-wrap: wrap;
}
.form-inline-row input[type=text],
.form-inline-row input[type=password],
.form-inline-row select { flex: 1; min-width: 120px; }
.form-inline-row input[type=color] {
    width: 40px;
    height: 36px;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.data-table th {
    background: var(--surface2);
    padding: .6rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.edit-row td { background: var(--bg) !important; padding: .75rem 1rem; }

.actions-cell { display: flex; gap: .5rem; align-items: center; }

.color-swatch {
    display: inline-block;
    width: 20px; height: 20px;
    border-radius: 4px;
    vertical-align: middle;
    border: 1px solid rgba(255,255,255,.1);
}

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.badge-admin { background: #2a1a3a; color: #c084fc; border: 1px solid #6d28d9; }
.badge-user  { background: #0f2030; color: #60a5fa; border: 1px solid #1d4ed8; }
.badge-pending { background: #2d1f00; color: #fbbf24; border: 1px solid #92400e; }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 640px) {
    .form-row { flex-direction: column; }
    .nav-links { gap: .4rem; }
    .week-nav  { padding: .6rem 1rem; }
    .admin-wrap { padding: 1rem; }
    .actions-cell { flex-wrap: wrap; }
}
