/* Running Dinner – Organiser Portal Styles */

/* ── Auth page ──────────────────────────────────────────────────────────── */
.rd-org-auth { max-width: 480px; margin: 0 auto; padding: 0 16px 60px; }

.rd-org-auth-hero {
    background: linear-gradient(135deg, #e85d04 0%, #c44b02 50%, #2d6a4f 100%);
    border-radius: 18px;
    padding: 48px 32px;
    text-align: center;
    margin-bottom: 32px;
    color: #fff;
}
.rd-org-logo { font-size: 56px; margin-bottom: 12px; }
.rd-org-auth-hero h1 {
    font-family: var(--rd-font-head);
    font-size: 32px;
    margin: 0 0 6px;
    color: #fff;
}
.rd-org-auth-hero p { margin: 0; opacity: .85; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }

.rd-org-panel {
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius);
    box-shadow: var(--rd-shadow);
    padding: 32px;
    animation: rd-slide-up .35s ease both;
}
.rd-org-panel h2 {
    font-family: var(--rd-font-head);
    font-size: 22px;
    margin: 0 0 24px;
}
.rd-org-auth-switch { text-align: center; font-size: 14px; margin-top: 20px; color: var(--rd-muted); }
.rd-org-auth-switch a { color: var(--rd-primary); text-decoration: none; font-weight: 600; }

/* ── Portal layout ──────────────────────────────────────────────────────── */
.rd-org-portal {
    max-width: 100%;
    padding: 0;
    font-family: var(--rd-font-body);
}

.rd-org-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--rd-text);
    color: #fff;
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 12px 12px 0 0;
}
.rd-org-nav-brand { font-family: var(--rd-font-head); font-size: 18px; font-weight: 700; }
.rd-org-nav-right { display: flex; align-items: center; gap: 14px; }
.rd-org-nav-user { font-size: 13px; opacity: .75; }
.rd-org-nav .rd-btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); font-size: 13px; padding: 6px 14px; }
.rd-org-nav .rd-btn-ghost:hover { border-color: #fff; color: #fff; }

.rd-org-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 600px;
    border: 1px solid var(--rd-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: clip; /* clip for border-radius only — does NOT create a scroll container, so drag-and-drop works */
}
@media (max-width: 720px) { .rd-org-body { grid-template-columns: 1fr; } }

/* ── Sidebar ── */
.rd-org-sidebar {
    background: #f7f4f0;
    border-right: 1px solid var(--rd-border);
    padding: 20px 0;
}
.rd-org-sidebar-section { padding: 0 16px 20px; border-bottom: 1px solid var(--rd-border); margin-bottom: 16px; }
.rd-org-sidebar-section:last-child { border-bottom: none; margin-bottom: 0; }
.rd-org-sidebar-heading { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--rd-muted); margin-bottom: 10px; }
.rd-org-sidebar-empty { font-size: 13px; color: var(--rd-muted); }

.rd-org-event-list { list-style: none; padding: 0; margin: 0; }
.rd-org-event-list li { border-radius: 8px; margin-bottom: 4px; }
.rd-org-event-list li.active { background: rgba(232,93,4,.10); }
.rd-org-event-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--rd-text);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
}
.rd-org-event-link:hover { background: rgba(232,93,4,.07); }
.rd-org-event-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main ── */
.rd-org-main { padding: 28px; }

/* ── Event header ── */
.rd-org-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.rd-org-event-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-org-event-header-actions { display: flex; gap: 8px; }
.rd-org-event-title { font-family: var(--rd-font-head); font-size: 26px; margin: 0; }
.rd-org-theme-tag { font-size: 13px; color: var(--rd-muted); }

/* ── Tooltips ── */
/* Usage: <span class="rd-tip" data-tip="Tooltip text here">ⓘ</span> */
.rd-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--rd-border);
    color: var(--rd-muted);
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
    transition: background .15s, color .15s;
    user-select: none;
}
.rd-tip:hover { background: var(--rd-primary); color: #fff; }
/* The floating tooltip bubble */
.rd-tooltip-bubble {
    position: fixed;
    background: #1a202c;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.5;
    max-width: 280px;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    white-space: pre-wrap;
}
/* Stat tiles with tooltip are clickable on touch */
.rd-org-stat { cursor: default; }
.rd-org-stat:has(.rd-tip) { cursor: help; }

/* ── Stats ── */
.rd-org-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (max-width: 600px) { .rd-org-stats { grid-template-columns: repeat(2,1fr); } }
.rd-org-stat {
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.rd-org-stat-value { font-size: 28px; font-weight: 700; color: var(--rd-primary); font-family: var(--rd-font-head); }
.rd-org-stat-label { font-size: 12px; color: var(--rd-muted); margin-top: 2px; }

/* ── Reg link box ── */
.rd-org-reg-link-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff8f4;
    border: 1px solid #fcdcc9;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.rd-org-reg-link-label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.rd-org-reg-link-input {
    flex: 1;
    min-width: 180px;
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    background: #fff;
    color: var(--rd-text);
}

/* ── Tabs ── */
.rd-org-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--rd-border); margin-bottom: 20px; }
.rd-org-tab {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    font-size: 14px;
    color: var(--rd-muted);
    cursor: pointer;
    transition: all .15s;
    font-family: var(--rd-font-body);
}
.rd-org-tab:hover, .rd-org-tab.active { color: var(--rd-primary); border-bottom-color: var(--rd-primary); }
.rd-org-tab-panel { display: none; }
.rd-org-tab-panel.active { display: block; }
.rd-org-tab-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.rd-tab-hint { font-size: 13px; }

/* ── Teams ── */
.rd-org-team-card {
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: 10px;
    margin-bottom: 14px;
    overflow: hidden;
}
.rd-org-team-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 18px;
    background: #f7fafc;
    border-bottom: 1px solid var(--rd-border);
    flex-wrap: wrap;
    gap: 8px;
}
.rd-org-team-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-org-team-name { font-weight: 700; font-size: 15px; }
.rd-org-team-address { font-size: 12px; color: var(--rd-muted); margin-top: 2px; }
.rd-org-team-token { font-size: 12px; color: var(--rd-muted); }
.rd-org-team-token code { background: var(--rd-border); padding: 2px 6px; border-radius: 4px; }

.rd-org-participants-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rd-org-participants-table th { padding: 8px 14px; text-align: left; font-weight: 600; color: var(--rd-muted); border-bottom: 1px solid var(--rd-border); }
.rd-org-participants-table td { padding: 8px 14px; border-bottom: 1px solid #f5f0eb; vertical-align: middle; }
.rd-org-participants-table tr:last-child td { border-bottom: none; }
.rd-org-participants-table select { font-size: 12px; padding: 3px 7px; border: 1px solid var(--rd-border); border-radius: 4px; font-family: var(--rd-font-body); }

.rd-org-add-row { padding: 10px 14px; background: #fafafa; }
.rd-org-add-fields { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rd-org-add-fields input { flex: 1; min-width: 120px; padding: 6px 10px; border: 1.5px solid var(--rd-border); border-radius: 6px; font-size: 13px; font-family: var(--rd-font-body); }

.rd-org-loading { color: var(--rd-muted); padding: 20px; text-align: center; font-size: 14px; }

/* ── Schedule ── */
.rd-org-schedule-course { margin-bottom: 24px; }
.rd-org-schedule-course h4 { font-size: 15px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.rd-org-schedule-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.rd-org-schedule-card { background: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 10px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
.rd-org-schedule-card.rd-drop-over { border-color: var(--rd-primary); box-shadow: 0 0 0 2px var(--rd-primary-light, #bfdbfe); background: var(--rd-bg-alt); }
.rd-org-schedule-host { font-weight: 600; margin-bottom: 2px; font-size: 13px; }
.rd-org-schedule-addr { font-size: 11px; color: var(--rd-muted); margin-bottom: 6px; }
/* Guest toggle button */
.rd-schedule-guests-toggle { margin-top: 8px; }
.rd-schedule-guests-toggle .rd-btn-ghost { font-size: 11px; padding: 2px 8px; color: var(--rd-muted); }
/* Guest list */
.rd-schedule-guest-list { margin-top: 6px; border-top: 1px solid var(--rd-border); padding-top: 6px; min-height: 28px; }
/* Individual guest row — click to select for moving */
.rd-schedule-guest-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 5px; font-size: 12px; user-select: none; -webkit-user-select: none; }
.rd-draggable-guest { cursor: pointer; }
.rd-draggable-guest:hover { background: var(--rd-bg-alt); }
.rd-guest-selected { background: var(--rd-primary); color: #fff; border-radius: 5px; }
.rd-guest-selected:hover { background: var(--rd-primary); }
/* Host card highlighted as a valid move target */
.rd-move-target { border-color: var(--rd-primary) !important; cursor: pointer; box-shadow: 0 0 0 2px var(--rd-primary-light, #bfdbfe); }
/* Hint text shown inside the selected guest's host card */
.rd-schedule-move-hint { font-size: 11px; color: var(--rd-primary); padding: 4px 2px 6px; font-style: italic; }

/* Host header — clickable for swapping */
.rd-swappable-host { cursor: pointer; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; transition: background .1s; display: inline-block; }
.rd-swappable-host:hover { background: var(--rd-bg-alt); }
.rd-host-swap-hint { opacity: .5; }
.rd-org-schedule-card.rd-host-selected { background: var(--rd-primary-light, #eff6ff); border-color: var(--rd-primary) !important; }
.rd-org-schedule-card.rd-swap-target { border-color: var(--rd-primary) !important; cursor: pointer; box-shadow: 0 0 0 2px var(--rd-primary-light, #bfdbfe); }
.rd-org-schedule-card.rd-swap-target:hover { background: var(--rd-bg-alt); }
.rd-schedule-swap-hint { font-size: 11px; color: var(--rd-primary); padding: 0 2px 6px; font-style: italic; }

/* ── Send panel ── */
.rd-org-send-panel {
    margin-top: 24px;
    background: #f7fafc;
    border: 1px solid var(--rd-border);
    border-radius: 12px;
    padding: 24px;
}
.rd-org-send-panel h3 { margin: 0 0 8px; font-size: 16px; }
.rd-org-send-panel .rd-field input,
.rd-org-send-panel .rd-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--rd-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--rd-font-body);
    background: #fff;
    transition: border-color .15s;
    box-sizing: border-box;
}
.rd-org-send-panel .rd-field input:focus,
.rd-org-send-panel .rd-field textarea:focus { outline: none; border-color: var(--rd-primary); }
.rd-org-send-panel .rd-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.rd-org-send-panel .rd-field { margin-bottom: 14px; }

/* ── Notifications ── */
.rd-org-notif-list { display: flex; flex-direction: column; gap: 10px; }
.rd-org-notif-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--rd-surface);
    border: 1px solid var(--rd-border);
    border-radius: 8px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.rd-org-notif-actions { display: flex; gap: 8px; align-items: center; }
.rd-org-notif-actions input[type=time] { padding: 6px 10px; border: 1.5px solid var(--rd-border); border-radius: 6px; font-size: 14px; font-family: var(--rd-font-body); }

/* ── Modal ── */
.rd-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rd-modal {
    background: var(--rd-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: rd-slide-up .25s ease;
}
.rd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--rd-border);
    position: sticky;
    top: 0;
    background: var(--rd-surface);
    z-index: 1;
}
.rd-modal-header h3 { margin: 0; font-family: var(--rd-font-head); font-size: 20px; }
.rd-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--rd-muted); line-height: 1; padding: 4px 8px; }
.rd-modal-close:hover { color: var(--rd-text); }
.rd-modal-body { padding: 28px; }

/* ── Event form inside modal ── */
.rd-org-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 600px) { .rd-org-form-grid { grid-template-columns: 1fr; } }
.rd-org-form-grid .rd-field input,
.rd-org-form-grid .rd-field textarea,
.rd-org-form-grid .rd-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--rd-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--rd-font-body);
    background: var(--rd-bg);
    transition: border-color .15s;
    box-sizing: border-box;
}
.rd-org-form-grid .rd-field input:focus,
.rd-org-form-grid .rd-field textarea:focus,
.rd-org-form-grid .rd-field select:focus { outline: none; border-color: var(--rd-primary); background: #fff; }
.rd-org-form-grid .rd-field { margin-bottom: 14px; }
.rd-org-form-grid .rd-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.rd-org-form-grid .rd-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rd-org-form-grid .rd-field-row .rd-field { margin-bottom: 0; }

.rd-org-courses-section { margin-bottom: 20px; }
.rd-org-courses-section h4 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.rd-org-courses-section .rd-course-row input { padding: 7px 10px; border: 1.5px solid var(--rd-border); border-radius: 6px; font-size: 13px; font-family: var(--rd-font-body); }
.rd-org-form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* ── Utilities ── */
.rd-hidden { display: none !important; }
.rd-org-welcome { display: flex; align-items: center; justify-content: center; min-height: 400px; }
.rd-org-empty-schedule { padding: 30px 0; }

/* ── Teams toolbar ── */
.rd-org-teams-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.rd-org-team-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.rd-org-team-status-select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1.5px solid var(--rd-border);
    border-radius: 6px;
    font-family: var(--rd-font-body);
    background: var(--rd-bg);
}

/* ── Shared button system ────────────────────────────────────────────────────
   These are used throughout the organiser portal (courses, teams, schedule).
   Mirrors admin.css so both contexts render identically.              ── */
.rd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, opacity .15s, border-color .15s, color .15s;
    font-family: var(--rd-font-body);
    white-space: nowrap;
    text-decoration: none;
}
.rd-btn:disabled { opacity: .55; cursor: not-allowed; }
.rd-btn-primary   { background: var(--rd-primary); color: #fff; border-color: var(--rd-primary); }
.rd-btn-primary:hover:not(:disabled) { background: var(--rd-primary-h); border-color: var(--rd-primary-h); color: #fff; }
.rd-btn-secondary { background: var(--rd-secondary); color: #fff; border-color: var(--rd-secondary); }
.rd-btn-secondary:hover:not(:disabled) { opacity: .9; color: #fff; }
.rd-btn-danger    { background: var(--rd-danger); color: #fff; border-color: var(--rd-danger); }
.rd-btn-danger:hover:not(:disabled) { opacity: .85; color: #fff; }
.rd-btn-ghost     { background: transparent; color: var(--rd-text); border: 2px solid var(--rd-border); }
.rd-btn-ghost:hover:not(:disabled) { border-color: var(--rd-primary); color: var(--rd-primary); }
.rd-btn-sm  { padding: 7px 14px; font-size: 13px; }
.rd-btn-xs  { padding: 4px 10px; font-size: 12px; }
.rd-btn-full { width: 100%; justify-content: center; }

/* ── Course row grid ─────────────────────────────────────────────────────────
   handle | name text input | time input | ✕ button                   ── */
.rd-course-row {
    display: grid;
    grid-template-columns: 24px 1fr 110px 32px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.rd-course-handle {
    cursor: grab;
    color: var(--rd-muted);
    user-select: none;
    font-size: 16px;
}
.rd-course-row input[type="text"],
.rd-course-row input[type="time"] {
    padding: 7px 10px;
    border: 1.5px solid var(--rd-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--rd-font-body);
    background: var(--rd-bg);
    width: 100%;
    box-sizing: border-box;
}
.rd-course-row input:focus {
    outline: none;
    border-color: var(--rd-primary);
}

/* ── CSS variables (mirrors admin.css — needed when organiser.css loads alone) */
:root {
    --rd-primary:   #e85d04;
    --rd-primary-h: #c44b02;
    --rd-secondary: #2d6a4f;
    --rd-danger:    #c0392b;
}

/* ── Email Templates tab ── */
.rd-tpl-list { display: flex; flex-direction: column; gap: 0; }
.rd-tpl-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--rd-border);
}
.rd-tpl-row:last-child { border-bottom: none; }
.rd-tpl-row-left { flex-shrink: 0; padding-top: 2px; }
.rd-tpl-skip-label { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.rd-tpl-skip-label input { cursor: pointer; width: 16px; height: 16px; }
.rd-tpl-skip-text { font-size: 10px; color: var(--rd-muted); }
.rd-tpl-row-main { flex: 1; min-width: 0; }
.rd-tpl-skipped { opacity: .45; }
.rd-tpl-row-header { font-size: 14px; margin-bottom: 3px; }
.rd-tpl-row-desc { font-size: 12px; margin-bottom: 2px; }
.rd-tpl-row-when { margin-top: 2px; }
.rd-tpl-row-actions { flex-shrink: 0; }
