@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Syne:wght@400;700&display=swap');

:root {
    --bg: #0c0c0e;
    --surface: #141417;
    --surface2: #1c1c21;
    --border: #2a2a32;
    --accent: #00e5ff;
    --accent-dim: rgba(0, 229, 255, 0.08);
    --accent-glow: rgba(0, 229, 255, 0.15);
    --text: #e8e8f0;
    --muted: #5a5a6e;
    --label: #8888a0;
    --danger: #ff4f4f;
    --success: #39d98a;
    --warn: #ffb347;
    --radius: 8px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Subtle grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,229,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,229,255,0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.page-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    padding: 0 20px 60px;
}

/* HEADER */
header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.logo-mark {
    color: var(--accent);
    font-size: 18px;
    filter: drop-shadow(0 0 6px var(--accent));
}

.logo-text {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
}

/* MAIN LAYOUT */
.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* VIDEO */
.video-wrap {
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    position: relative;
}

.video-wrap::before {
    content: 'NO SIGNAL';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--muted);
    pointer-events: none;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 1;
}

/* PANEL */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* FIELD GROUP */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--label);
}

label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text);
    cursor: pointer;
}

label.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent, #6c8cff);
    cursor: pointer;
}

input[type="text"] {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--text);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input[type="text"]::placeholder {
    color: var(--muted);
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* SELECT */
.select-wrap {
    position: relative;
}

select {
    appearance: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 36px 10px 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--text);
    width: 100%;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

select:focus {
    border-color: var(--accent);
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 16px;
}

/* DRM FIELDS */
.drm-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--accent-dim);
    border: 1px solid rgba(0,229,255,0.12);
    border-radius: 6px;
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ACTIONS */
.actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-play {
    background: var(--accent);
    color: #000;
    flex: 1;
}

.btn-play:hover {
    background: #33eeff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-play:active {
    transform: scale(0.98);
}

.btn-stop {
    background: var(--surface2);
    color: var(--label);
    border: 1px solid var(--border);
}

/* Secondary: outlined dashed style — used for toggles like "+ Add another
   header" and the legacy mint-token slot. Matches ipackager's add-header-btn. */
.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px dashed var(--accent);
    border-radius: 5px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
}
.btn-secondary:hover { background: rgba(0, 224, 255, .08); }

/* Primary action: filled accent, stands out next to btn-secondary. Used for
   the "Mint License Token" button so it's clearly the main action. */
.btn-primary {
    background: var(--accent);
    color: #000;
    border: 1px solid var(--accent);
    border-radius: 5px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}
.btn-primary:hover { background: #33eeff; box-shadow: 0 0 16px var(--accent-glow); }
.btn-primary:active { transform: scale(0.98); }

.btn-stop:hover {
    background: #222228;
    color: var(--text);
    border-color: #3a3a45;
}

.btn-save {
    background: var(--surface2);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-save:hover {
    background: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-save:active {
    transform: scale(0.98);
}

.btn-delete {
    background: var(--surface2);
    color: var(--danger);
    border: 1px solid rgba(255, 79, 79, 0.4);
}

.btn-delete:hover {
    background: rgba(255, 79, 79, 0.08);
    border-color: var(--danger);
}

.btn-icon {
    font-size: 11px;
}

/* PRESETS */
.presets-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.presets-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--label);
}

.preset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.preset-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.preset-card:hover {
    border-color: rgba(0, 229, 255, 0.35);
    box-shadow: 0 0 12px var(--accent-glow);
}

.preset-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.preset-meta {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.preset-url {
    font-size: 11px;
    color: var(--muted);
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preset-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 11px;
    flex: 1;
    justify-content: center;
}

/* STATUS */
.status {
    margin-top: 14px;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-align: center;
    min-height: 20px;
    transition: color 0.2s;
}

/* Responsive */
@media (max-width: 600px) {
    .field-row {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .panel {
        padding: 16px;
    }
}

.mixed-content-hint {
    margin: 10px auto;
    max-width: 800px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #664d03;
    line-height: 1.5;
}
.mixed-content-hint code {
    background: #ffe8a1;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82rem;
}
