/* ============================================================
   FedCon 34 Schedule — Mobile-first stylesheet
   ============================================================ */

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

:root {
    --header-h: 56px;
    --bg:       #f1f5f9;
    --surface:  #ffffff;
    --border:   #e2e8f0;
    --text:     #1e293b;
    --muted:    #64748b;
    --accent:   #2563eb;
    --fav-on:   #ef4444;
    --fav-off:  #cbd5e1;
    --radius:   10px;
}

html { font-size: 15px; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }

/* ---- HEADER ---- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1e293b;
    color: #fff;
    height: var(--header-h);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 1rem;
}
.header-brand { display: flex; flex-direction: column; }
.header-title { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.header-sub   { font-size: .7rem; color: #94a3b8; }

.header-nav   { display: flex; gap: .5rem; flex-shrink: 0; }
.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: .8rem;
    font-weight: 500;
    padding: .35rem .65rem;
    border-radius: 6px;
    white-space: nowrap;
    position: relative;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,.1); }
.nav-active      { color: #fff !important; background: rgba(255,255,255,.15) !important; }

.fav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fav-on);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 4px;
    margin-left: 4px;
    vertical-align: middle;
}
.fav-badge.hidden { display: none; }

/* ---- PAGE WRAP ---- */
.page-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: .75rem .75rem 4rem;
}

/* ---- TABS ---- */
.tabs {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 4px;
    gap: 4px;
    margin-bottom: .75rem;
    border: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    padding: .55rem;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tab-btn:hover  { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; }

/* ---- ROOM FILTERS ---- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .75rem;
}
.filter-btn {
    padding: .3rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.filter-btn:hover        { border-color: var(--rc, var(--accent)); color: var(--rc, var(--accent)); }
.filter-btn.active       { background: var(--rc, var(--accent)); border-color: var(--rc, var(--accent)); color: #fff; }
.filter-all.active       { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- DAY PANEL ---- */
.day-panel[hidden] { display: none; }
.day-panel         { display: block; }

/* ---- EVENT LIST ---- */
.event-list { display: flex; flex-direction: column; gap: .5rem; }

/* ---- EVENT CARD ---- */
.event-card {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 4px solid var(--rc, #ccc);
    padding: .65rem .65rem .65rem .75rem;
    transition: box-shadow .15s;
}
.event-card:hover    { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.event-card.is-fav   { background: #fef2f2; border-color: #fca5a5; border-left-color: var(--rc, #ccc); }

/* Time column */
.event-time {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
    min-width: 40px;
    text-align: center;
    padding-top: 2px;
    flex-shrink: 0;
    line-height: 1.3;
}
.time-end { font-weight: 400; color: var(--muted); }

/* Body */
.event-body  { flex: 1; min-width: 0; }

.event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: .35rem;
}
.badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.badge-room { color: #fff; }
.badge-type { background: #f1f5f9; color: var(--muted); }
.badge-lang { background: #dbeafe; color: #1e40af; }

.event-title {
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}
.event-speaker {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .2rem;
}

/* Favorite button */
.fav-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 7px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    align-self: center;
}
.fav-btn:hover    { background: #fee2e2; }
.fav-btn svg      { width: 20px; height: 20px; fill: var(--fav-off); transition: fill .15s; }
.fav-btn.favorited svg { fill: var(--fav-on); }
.fav-btn:disabled { opacity: .5; pointer-events: none; }

/* ---- MY SCHEDULE PAGE ---- */
.my-schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
}
.my-schedule-header h2 { font-size: 1.2rem; }

.day-section   { margin-bottom: 1.5rem; }
.day-heading   {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: .5rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--border);
}

/* iCal button */
.ical-btn {
    display: inline-block;
    background: #059669;
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    padding: .5rem 1.1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: background .15s;
}
.ical-btn:hover { background: #047857; }

.ical-footer {
    margin-top: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}
.ical-hint {
    font-size: .78rem;
    color: var(--muted);
    max-width: 420px;
    text-align: left;
}
.ical-hint code {
    display: block;
    word-break: break-all;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 5px;
    margin-top: 3px;
    font-size: .72rem;
    user-select: all;
}

/* Plan share widget */
.plan-share {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.plan-share-label {
    font-size: .75rem;
    color: var(--muted);
    margin: 0 0 .4rem;
}
.plan-share-row {
    display: flex;
    gap: .5rem;
}
.plan-share-url {
    flex: 1;
    font-size: .72rem;
    font-family: monospace;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 4px 7px;
    color: #334155;
    background: white;
    min-width: 0;
}
.plan-share-copy {
    font-size: .72rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
}
.plan-share-copy:hover { background: #2563eb; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}
.empty-state p    { margin-bottom: 1rem; }
.btn-back {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: .5rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
}
.empty-msg { text-align: center; color: var(--muted); padding: 2rem; }

/* ============================================================
   MY SCHEDULE — TIMELINE VIEW
   ============================================================ */

.tl-wrap {
    display: flex;
    gap: 0;
    margin-bottom: .5rem;
}

/* Time labels */
.tl-times {
    width: 52px;
    flex-shrink: 0;
    position: relative;
}
.tl-time-label {
    position: absolute;
    right: 10px;
    transform: translateY(-50%);
    font-size: .62rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
    line-height: 1;
}
.tl-time-label.is-hour {
    color: var(--text);
    font-size: .68rem;
}

/* Body */
.tl-body {
    flex: 1;
    position: relative;
    border-left: 2px solid var(--border);
}

/* Grid lines */
.tl-hline {
    position: absolute;
    left: -2px;
    right: 0;
    pointer-events: none;
    z-index: 0;
}
.tl-hline.is-hour { height: 2px; background: #cbd5e1; }
.tl-hline.is-half { height: 1px; background: #e2e8f0; }

/* Gap indicator */
.tl-gap {
    position: absolute;
    left: 12px;
    right: 12px;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .68rem;
    color: #94a3b8;
    font-style: italic;
    pointer-events: none;
}
.tl-gap::before,
.tl-gap::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

/* Event card */
.tl-event {
    position: absolute;
    background: white;
    border: 1px solid color-mix(in srgb, var(--rc) 30%, #dde3ec);
    border-left: 3px solid var(--rc);
    border-radius: 6px;
    padding: 5px 6px 5px 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
    z-index: 2;
    min-height: 75px; /* keeps 15-min slots readable, slightly non-proportional */
    transition: box-shadow .12s;
}
.tl-event:hover    { box-shadow: 0 3px 14px rgba(0,0,0,.14); z-index: 10; }
.tl-event.has-conflict {
    border-top: 2px solid #f59e0b;
    background: #fffbeb;
}

.tl-ev-time {
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.tl-ev-dur {
    font-weight: 400;
    color: #94a3b8;
}
.tl-ev-title {
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.tl-ev-room {
    font-size: .65rem;
    color: var(--muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tl-ev-header {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tl-ev-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
}
.tl-conflict-warn {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    border-radius: 3px;
    font-size: .58rem;
    font-weight: 700;
    padding: 1px 4px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Check-in block (timeline view) */
.tl-checkin {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: .05em;
    text-transform: uppercase;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        rgba(148,163,184,.08) 6px,
        rgba(148,163,184,.08) 12px
    );
    border-bottom: 1px dashed #cbd5e1;
}

/* Fav button inside timeline event */
.tl-event .fav-btn {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 3px;
    border-radius: 4px;
}
.tl-event .fav-btn svg { width: 14px; height: 14px; }

/* ---- Responsive (list view on my-schedule) ---- */
@media (min-width: 600px) {
    .event-card    { padding: .8rem; }
    .event-title   { font-size: .95rem; }
    .event-time    { min-width: 50px; font-size: .82rem; }
}

/* ============================================================
   TIMETABLE GRID VIEW
   30px per 15-minute slot  |  grid-row 1 = header (36px)
   ============================================================ */

.timetable-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.timetable {
    display: grid;
    grid-template-columns: 48px repeat(5, minmax(150px, 1fr));
    grid-template-rows: 36px;   /* explicit header height */
    grid-auto-rows: 40px;       /* 40px = 15 minutes */
    min-width: 800px;
    position: relative;
    background: #f8fafc;
}

/* ── Corner (top-left) ── */
.tt-corner {
    grid-row: 1;
    grid-column: 1;
    background: #1e293b;
    position: sticky;
    left: 0;
    z-index: 10;
}

/* ── Room headers ── */
.tt-room-hdr {
    grid-row: 1;
    background: var(--rc);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 4px;
    border-left: 1px solid rgba(255,255,255,.2);
}

/* ── Time labels ── */
.tt-time {
    grid-column: 1;
    background: #f1f5f9;
    font-size: .65rem;
    font-weight: 600;
    color: var(--muted);
    display: flex;
    align-items: flex-start;
    padding: 3px 6px 0;
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 1px solid var(--border);
}
.tt-time-hour {
    color: var(--text);
    font-size: .7rem;
    background: #e8edf4;
}

/* ── Hour / half-hour separator lines ── */
.tt-hour-rule,
.tt-half-rule {
    align-self: start;
    height: 1px;
    pointer-events: none;
    z-index: 0;
}
.tt-hour-rule { background: #94a3b8; }
.tt-half-rule { background: #dde3ec; }

/* ── Event cards in timetable ── */
.tt-event {
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--rc) 35%, #dde3ec);
    border-left: 3px solid var(--rc);
    border-radius: 4px;
    margin: 2px 2px 2px 1px;
    padding: 3px 22px 3px 5px;  /* right padding = space for fav btn */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    position: relative;
    z-index: 1;
    transition: box-shadow .12s, z-index 0s .12s;
}
.tt-event:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    z-index: 8;
    transition: box-shadow .12s, z-index 0s;
}
.tt-event.is-fav {
    background: #fff5f5;
    border-color: #fca5a5;
    border-left-color: #ef4444;
}

.tt-ev-time {
    font-size: .58rem;
    color: var(--muted);
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}
.tt-ev-title {
    font-size: .73rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
}
.tt-ev-speaker {
    font-size: .62rem;
    color: var(--muted);
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
/* Only show lang badge in timetable — type badge is noise at this scale */
.tt-ev-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 1px;
}
.tt-ev-foot .badge-type { display: none; }
.tt-ev-foot .badge-lang {
    font-size: .55rem;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Check-in block (timetable grid view) */
.tt-checkin {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        rgba(148,163,184,.07) 6px,
        rgba(148,163,184,.07) 12px
    );
    border-bottom: 1px dashed #cbd5e1;
    z-index: 0;
}

/* Favorite button — absolute top-right of event card */
.tt-event .fav-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 2px;
    border-radius: 3px;
}
.tt-event .fav-btn:hover { background: #fee2e2; }
.tt-event .fav-btn svg   { width: 14px; height: 14px; }
