/* ── Ad Classifier Modal ─────────────────────────────────────────── */

.ad-classifier-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-classifier-modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.modal-dialog {
    position: relative;
    background: #1e1e2e;
    border: 1px solid #3a3a52;
    border-radius: 8px;
    width: 560px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #3a3a52;
}

.modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e2e2f0;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.modal-close:hover { color: #e2e2f0; }

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body label {
    font-size: 11px;
    font-weight: 600;
    color: #a0a0b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    display: block;
}

.modal-body label .optional {
    font-weight: 400;
    text-transform: none;
    color: #666;
    font-size: 10px;
}

/* Advertiser search */
.advertiser-search-wrap {
    position: relative;
}

#advertiser-search {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    background: #12121e;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #e2e2f0;
    font-size: 13px;
    outline: none;
}
#advertiser-search:focus { border-color: #5a8dee; }
#advertiser-search.input-error { border-color: #e05050; }

#advertiser-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: #1e1e2e;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    max-height: 160px;
    overflow-y: auto;
    z-index: 10;
    list-style: none;
    margin: 0; padding: 4px 0;
}

#advertiser-suggestions li {
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #e2e2f0;
}
#advertiser-suggestions li:hover { background: #2a2a3e; }
#advertiser-suggestions li.add-new { color: #5a8dee; font-style: italic; }

.advertiser-error {
    display: none;
    font-size: 11px;
    color: #e05050;
    margin-top: 2px;
}

/* Campaign select */
#campaign-select {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    background: #12121e;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #e2e2f0;
    font-size: 13px;
    outline: none;
}
#campaign-select:focus { border-color: #5a8dee; }

/* Description */
#creative-description {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    background: #12121e;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #e2e2f0;
    font-size: 13px;
    outline: none;
}
#creative-description:focus { border-color: #5a8dee; }

/* Modal footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #3a3a52;
}

.modal-cancel {
    background: none;
    border: 1px solid #3a3a52;
    color: #a0a0b8;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
}
.modal-cancel:hover { border-color: #666; color: #e2e2f0; }

.modal-submit {
    background: #5a8dee;
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.modal-submit:hover:not(:disabled) { background: #4a7dde; }
.modal-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Toast ───────────────────────────────────────────────────────── */

.ad-classifier-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2a2a3e;
    border: 1px solid #3a3a52;
    color: #e2e2f0;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 13px;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: toast-in 0.15s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

/* ── Advertiser Management Panel ─────────────────────────────────── */

#advertiser-manager-panel {
    position: fixed;
    top: 60px;
    right: 16px;
    width: 320px;
    max-height: calc(100vh - 80px);
    background: #1e1e2e;
    border: 1px solid #3a3a52;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 900;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#advertiser-manager-panel.hidden { display: none; }

.mgr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #3a3a52;
}

.mgr-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #e2e2f0;
}

.mgr-header-actions { display: flex; gap: 6px; }

.mgr-add-btn {
    background: #5a8dee;
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.mgr-add-btn:hover { background: #4a7dde; }

.mgr-close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
}
.mgr-close-btn:hover { color: #e2e2f0; }

#advertiser-manager-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

.mgr-loading, .mgr-empty, .mgr-error {
    padding: 16px;
    font-size: 12px;
    color: #888;
    text-align: center;
}
.mgr-error { color: #e05050; }

.mgr-advertiser-row {
    border-bottom: 1px solid #2a2a3e;
}

.mgr-advertiser-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 6px;
}

.mgr-name {
    flex: 1;
    font-size: 13px;
    color: #e2e2f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mgr-btn {
    background: none;
    border: 1px solid transparent;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    padding: 3px 7px;
    border-radius: 3px;
    flex-shrink: 0;
}
.mgr-btn:hover { color: #e2e2f0; border-color: #3a3a52; }
.mgr-delete-btn:hover, .mgr-delete-campaign-btn:hover { color: #e05050; border-color: #e05050; }

.mgr-campaigns {
    padding: 4px 12px 8px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mgr-campaigns.hidden { display: none; }

.mgr-campaign-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #a0a0b8;
}
.mgr-campaign-row span { flex: 1; }

.mgr-add-campaign-btn {
    background: none;
    border: none;
    color: #5a8dee;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 0;
    text-align: left;
}
.mgr-add-campaign-btn:hover { text-decoration: underline; }

/* ── Manage Advertisers button ───────────────────────────────────── */

#manage-advertisers-btn {
    font-size: 12px;
    padding: 5px 10px;
}

/* ── Mini player in modal ────────────────────────────────────────── */

.modal-frame-previews {
    margin-bottom: 14px;
}

.mini-player {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-player img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #3a3a52;
    background: #0d0d1a;
    display: block;
}

.mini-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-play-btn {
    background: none;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #c0c0d8;
    font-size: 13px;
    cursor: pointer;
    padding: 3px 8px;
    flex-shrink: 0;
}
.mini-play-btn:hover { background: #2a2a42; color: #e2e2f0; }

#mini-scrubber {
    flex: 1;
    height: 3px;
    accent-color: #5a8dee;
    cursor: pointer;
}

.mini-counter {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

#mini-fps {
    background: #13131f;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #a0a0b8;
    font-size: 11px;
    padding: 2px 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Inline campaign input ───────────────────────────────────────── */

.campaign-inline-input {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
}

.campaign-inline-input input {
    flex: 1;
    background: #13131f;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #e2e2f0;
    font-size: 12px;
    padding: 5px 8px;
    outline: none;
}
.campaign-inline-input input:focus { border-color: #5a8dee; }

.campaign-inline-save, .campaign-inline-cancel {
    background: none;
    border: 1px solid #3a3a52;
    border-radius: 4px;
    color: #a0a0b8;
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    white-space: nowrap;
}
.campaign-inline-save { color: #5a8dee; border-color: #5a8dee; }
.campaign-inline-save:hover { background: rgba(90,141,238,.12); }
.campaign-inline-cancel:hover { color: #e2e2f0; }

/* ── Marker segment label ────────────────────────────────────────── */

/* Do NOT override position:absolute from annotation-layer.css */
.marker-segment {
    overflow: hidden;
}

.marker-segment-label {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: rgba(255,255,255,0.9);
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    line-height: 1;
}

/* ── Marker context menu ─────────────────────────────────────────── */

.marker-ctx-menu {
    position: fixed;
    z-index: 2000;
    background: #1e1e2e;
    border: 1px solid #3a3a52;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    min-width: 160px;
    padding: 4px 0;
    font-size: 13px;
}

.ctx-item {
    padding: 7px 14px;
    cursor: pointer;
    color: #c0c0d8;
    user-select: none;
}
.ctx-item:hover { background: #2a2a42; color: #e2e2f0; }
.ctx-header {
    color: #666;
    font-size: 11px;
    cursor: default;
    border-bottom: 1px solid #2a2a3e;
    padding-bottom: 6px;
    margin-bottom: 2px;
}
.ctx-header:hover { background: none; color: #666; }
.ctx-danger { color: #e05050; }
.ctx-danger:hover { background: rgba(224,80,80,.1); color: #e05050; }
