/* ============================================================
   PRESENTER CONTROL PAGES - shared styles
   Used by tools/lyrics_presenter.php and tools/verse_presenter.php
   ============================================================ */

/* ============================================================
   TOKENS (light / dark)
   ============================================================ */
.lp {
    --lp-card:        #ffffff;
    --lp-surface:     #f6f7f9;
    --lp-border:      #e3e6eb;
    --lp-muted:       #6b7280;
    --lp-accent:      #2f4858;
    --lp-accent-soft: #fff1e6;
    --lp-accent-ink:  #ffffff;
    --lp-accent-line: #c3ccd2;                                              /* fallback */
    --lp-accent-line: color-mix(in srgb, var(--lp-accent) 30%, #ffffff);   /* light tint of the accent */
    --lp-success:     #16a34a;
    --lp-warn:        #b45309;
    --lp-radius:      12px;
    --lp-shadow:      0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
body.dark-mode .lp {
    --lp-card:        #16191d;
    --lp-surface:     #1d2126;
    --lp-border:      #2b3038;
    --lp-muted:       #9aa3ae;
    --lp-accent:      #ff8a3d;
    --lp-accent-soft: #3a2314;
    --lp-accent-ink:  #1a0d03;
    --lp-accent-line: #6b4a33;                                              /* fallback */
    --lp-accent-line: color-mix(in srgb, var(--lp-accent) 45%, #16191d);   /* muted tint on dark */
    --lp-success:     #4ade80;
    --lp-warn:        #fbbf24;
    --lp-shadow:      none;
}

/* Keep sticky ancestors visible */
.container, .row, .wrapper { overflow: visible !important; }

/* ============================================================
   CARDS & COMMON
   ============================================================ */
.lp-card {
    background: var(--lp-card);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    box-shadow: var(--lp-shadow);
    padding: 20px;
    box-sizing: border-box;
    min-width: 0;
}
.lp-card + .lp-card { margin-top: 16px; }

.lp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.lp-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--lp-muted);
}
.lp-muted { color: var(--lp-muted); font-size: 14px; }

.lp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid var(--lp-border);
    background: var(--lp-card);
    color: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, transform .05s;
}
.lp-btn:hover { background: var(--lp-surface); }
.lp-btn:active { transform: translateY(1px); }
.lp-btn svg { width: 18px; height: 18px; }

.lp-btn-primary {
    background: var(--lp-accent);
    border-color: var(--lp-accent);
    color: var(--lp-accent-ink);
}
.lp-btn-primary:hover { background: var(--lp-accent); filter: brightness(1.08); }

.lp-btn-icon { width: 36px; height: 36px; padding: 0; }

.lp select,
.lp input[type="color"] {
    font: inherit;
    color: inherit;
}
.lp select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    box-sizing: border-box;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.lp-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    margin-bottom: 20px;
}
.lp-song-info { min-width: 0; }
.lp-song-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--lp-accent);
    margin: 0 0 4px;
}
.lp-song-title {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lp-song-credits {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--lp-muted);
}
.lp-song-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--lp-accent);
    text-decoration: none;
}
.lp-song-link:hover { text-decoration: underline; }
.lp-song-link svg { width: 16px; height: 16px; }

.lp-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: end;
}
.lp-present-wrap { grid-column: 1 / -1; }
.lp-present-wrap .lp-btn { width: 100%; height: 46px; font-size: 16px; }
.lp-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--lp-muted);
    margin-bottom: 6px;
}

.lp-quicklinks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--lp-border);
    grid-column: 1 / -1;
}
.lp-quicklinks .lp-btn { height: 36px; font-size: 14px; font-weight: 500; }

/* ============================================================
   LAYOUT
   ============================================================ */
.lp-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 20px;
    align-items: start;
}

/* ============================================================
   SLIDES
   ============================================================ */
.lp-stanza { margin-bottom: 18px; }
.lp-stanza-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--lp-muted);
    margin: 0 0 8px;
}
.lp-slide {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--lp-border);
    border-left: 3px solid transparent;
    border-radius: 4px;
    background: var(--lp-surface);
    color: inherit;
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.lp-slide:hover { background: var(--lp-accent-soft); }
.lp-slide:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.lp-slide.active {
    background: var(--lp-accent-soft);
    /* Light, tinted border instead of the full accent colour */
    border-color: var(--lp-accent-line);
    border-left-color: var(--lp-accent-line);
}
.lp-slide-num {
    flex: none;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    border-radius: 3px;
    background: var(--lp-card);
    border: 1px solid var(--lp-border);
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    color: var(--lp-muted);
    box-sizing: border-box;
}
.lp-slide.active .lp-slide-num {
    background: var(--lp-accent);
    border-color: var(--lp-accent);
    color: var(--lp-accent-ink);
}
.lp-slide-live {
    display: none;
    margin-left: auto;
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--lp-accent);
}
.lp-slide.active .lp-slide-live { display: inline; }

#lyrics-container { padding-bottom: 200px; }

/* ============================================================
   SIDEBAR (sticky on desktop)
   ============================================================ */
#settings_panel {
    position: sticky;
    top: 90px;
    align-self: start;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    z-index: 10;
}

/* ============================================================
   LIVE PREVIEW
   ============================================================ */
.lp-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
/* Virtual 960×540 screen, scaled down to fit */
.lp-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 960px;
    height: 540px;
    transform-origin: top left;
    overflow: hidden;
}
.lp-stage-bg {
    position: absolute;
    inset: -40px;
    background-size: cover;
    background-position: center;
}
.lp-stage-overlay { position: absolute; inset: 0; }
.lp-stage-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 65px 58px;         /* same as the screen: 12vh / 6vw of 960×540 */
    text-align: center;
    box-sizing: border-box;
    text-transform: uppercase;
    font-weight: 700;
    font-synthesis: none;
    letter-spacing: .03em;
    word-spacing: .08em;
    text-shadow: 0 2px 10px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.35);
}
.lp-stage-vignette {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,.28), transparent 18%, transparent 82%, rgba(0,0,0,.28));
}
.lp-stage-stanza,
.lp-stage-credits {
    position: absolute;
    font-family: 'Roboto', sans-serif;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
/* Stanza number: top-left, as on the screen */
.lp-stage-stanza {
    top: 22px;
    left: 25px;
    display: flex;
    align-items: center;
    gap: .55em;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .75;
}
.lp-stage-stanza:not(:empty)::before {
    content: "";
    width: 3px;
    height: 1.1em;
    border-radius: 2px;
    background: currentColor;
    opacity: .7;
}
.lp-stage-credits {
    bottom: 18px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    letter-spacing: .06em;
    opacity: .7;
}

.lp-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}
.lp-preview-status { font-size: 13px; color: var(--lp-muted); }
.lp-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #ef4444;
    vertical-align: middle;
    box-shadow: 0 0 0 3px rgba(239,68,68,.2);
}
.lp-preview-nav { display: flex; gap: 6px; }

/* ============================================================
   SETTINGS FORM
   ============================================================ */
.lp-group { border-top: 1px solid var(--lp-border); padding-top: 14px; margin-top: 14px; }
.lp-group:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.lp-group-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 12px;
}

.lp-row { margin-bottom: 14px; }
.lp-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.lp-row-head label { font-size: 14px; font-weight: 500; }
.lp-row output {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
}

.lp input[type="range"] {
    width: 100%;
    accent-color: var(--lp-accent);
    margin: 0;
}

.lp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.lp-color {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}
.lp-color input[type="color"] {
    width: 100%;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    cursor: pointer;
    box-sizing: border-box;
}

.lp-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding: 8px 0;
    cursor: pointer;
}
.lp-switch input { width: 18px; height: 18px; accent-color: var(--lp-accent); cursor: pointer; }

.lp-save-bar {
    position: sticky;
    bottom: -20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px -20px -20px;
    padding: 14px 20px;
    background: var(--lp-card);
    border-top: 1px solid var(--lp-border);
    border-radius: 0 0 var(--lp-radius) var(--lp-radius);
}
.lp-save-state { font-size: 13px; color: var(--lp-muted); }
.lp-save-state.dirty { color: var(--lp-warn); font-weight: 600; }

/* ============================================================
   TIPS
   ============================================================ */
.lp-tips { font-size: 14px; line-height: 1.6; }
.lp-tips p { margin: 0 0 10px; }
.lp-tips ul { margin: 0 0 10px; padding-left: 18px; }
.lp-kbd {
    display: inline-block;
    padding: 0 6px;
    border: 1px solid var(--lp-border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--lp-surface);
    font-size: 12px;
    font-family: ui-monospace, Consolas, monospace;
}

/* ============================================================
   TOAST
   ============================================================ */
.lp-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    padding: 12px 18px;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 2000;
}
.lp-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lp-toast.error { background: #b91c1c; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .lp-toolbar { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .lp-layout { grid-template-columns: 1fr; }
    #settings_panel { position: static; max-height: none; overflow: visible; padding-right: 0; order: -1; }
    #lyrics-container { padding-bottom: 40px; }
}
@media (max-width: 480px) {
    .lp-controls { grid-template-columns: 1fr; }
    .lp-card { padding: 16px; }
    .lp-save-bar { margin: 18px -16px -16px; padding: 12px 16px; }
}
