/* ============================================
   Narrowcasting Editor - Premium Dark Theme
   ============================================ */

:root {
    /* VMTA Branding Colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f3f5;
    --bg-surface: #e9ecef;
    --bg-modal: #ffffff;

    --border-color: rgba(61, 64, 68, 0.15);
    --border-hover: rgba(61, 64, 68, 0.3);

    /* VMTA Text Colors */
    --text-primary: #3d4044;
    /* VMTA Dark Grey */
    --text-secondary: #5a5e63;
    --text-muted: #868e96;

    /* VMTA Accent Color */
    --accent: #29aae1;
    /* VMTA Light Blue */
    --accent-hover: #1f8cb9;
    --accent-glow: rgba(41, 170, 225, 0.3);

    --success: #20c997;
    --success-glow: rgba(32, 201, 151, 0.3);
    --danger: #fa5252;
    --danger-glow: rgba(250, 82, 82, 0.3);
    --warning: #fab005;

    --gradient-accent: linear-gradient(135deg, #29aae1, #48bcf0);
    --gradient-surface: linear-gradient(135deg, rgba(41, 170, 225, 0.1), rgba(41, 170, 225, 0.05));
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(41, 170, 225, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============ HEADER ============ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn .material-icons-round {
    font-size: 18px;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-accent {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.btn-accent:hover {
    background: rgba(108, 92, 231, 0.25);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(41, 170, 225, 0.05);
}

.btn-save {
    background: rgba(0, 206, 201, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 206, 201, 0.3);
}

.btn-save:hover {
    background: rgba(0, 206, 201, 0.25);
    border-color: var(--success);
    box-shadow: 0 2px 12px var(--success-glow);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: var(--danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(61, 64, 68, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-sm:hover {
    background: rgba(61, 64, 68, 0.12);
    color: var(--text-primary);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(61, 64, 68, 0.1);
    color: var(--accent);
}

/* ============ INPUTS ============ */
.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    transition: var(--transition);
    outline: none;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder {
    color: var(--text-muted);
}

.input-small {
    width: 120px;
}

.color-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    padding: 2px;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

textarea.input {
    resize: vertical;
    min-height: 60px;
}

.hint {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

/* ============ TOGGLE ============ */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(61, 64, 68, 0.1);
    border-radius: 13px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(22px);
    background: white;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.toolbar h2 {
    font-size: 24px;
    font-weight: 700;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
}

/* ============ SLIDES GRID ============ */
.slides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.slide-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.slide-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.slide-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.slide-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.slide-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: #1a1a2e;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.slide-preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
}

.slide-preview-content h3 {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.slide-preview-content p {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.slide-preview-content img {
    max-width: 80%;
    max-height: 60%;
    object-fit: contain;
    border-radius: 4px;
}

.slide-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slide-type-badge.content {
    background: var(--accent);
    color: white;
}

.slide-type-badge.weather {
    background: var(--success);
    color: #1a1a2e;
}

.slide-type-badge.video {
    background: var(--warning);
    color: #1a1a2e;
}

.slide-order {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.slide-info {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.slide-info-left h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.slide-info-left span {
    font-size: 11px;
    color: var(--text-muted);
}

.slide-actions {
    display: flex;
    gap: 4px;
}

.slide-actions .btn-icon {
    width: 30px;
    height: 30px;
}

.slide-actions .btn-icon .material-icons-round {
    font-size: 16px;
}

.slide-actions .btn-icon:hover.delete-btn {
    color: var(--danger);
    background: rgba(255, 107, 107, 0.1);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}

.empty-state.visible {
    display: flex;
}

.empty-state .material-icons-round {
    font-size: 72px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.slide-editor-modal {
    max-width: 1100px;
}

.settings-modal {
    max-width: 500px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ============ EDITOR LAYOUT ============ */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

.editor-preview {
    display: flex;
    flex-direction: column;
}

.preview-frame {
    width: 100%;
    aspect-ratio: 16/9;
    background: #1a1a2e;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
}

.preview-content {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.preview-draggable {
    position: absolute;
    cursor: move;
    border: 1px dashed transparent;
    transition: border 0.2s;
}

.preview-draggable:hover,
.preview-draggable.selected {
    border-color: rgba(255, 255, 255, 0.5);
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 1px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.preview-draggable.selected .resize-handle {
    opacity: 1;
    pointer-events: auto;
}

.resize-handle.top-left {
    top: -5px;
    left: -5px;
    cursor: nwse-resize;
}

.resize-handle.top-right {
    top: -5px;
    right: -5px;
    cursor: nesw-resize;
}

.resize-handle.bottom-left {
    bottom: -5px;
    left: -5px;
    cursor: nesw-resize;
}

.resize-handle.bottom-right {
    bottom: -5px;
    right: -5px;
    cursor: nwse-resize;
}

.preview-ticker {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 12px;
    background: rgba(108, 92, 231, 0.9);
    color: white;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

/* ============ CONTROL GROUPS ============ */
.control-group {
    margin-bottom: 16px;
}

.control-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

/* ============ CONTENT BLOCKS ============ */
.content-blocks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.content-block {
    background: rgba(61, 64, 68, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    position: relative;
}

.content-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.content-block-header span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.content-block-header .btn-icon {
    width: 24px;
    height: 24px;
}

.content-block-header .btn-icon .material-icons-round {
    font-size: 14px;
}

.content-block .input {
    font-size: 12px;
    padding: 8px 10px;
}

.content-block .file-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.content-block .upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent);
    border: 1px dashed rgba(108, 92, 231, 0.4);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.content-block .upload-btn:hover {
    background: rgba(108, 92, 231, 0.25);
}

.content-block .upload-preview {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    border-radius: 4px;
    margin-top: 4px;
}

.add-block-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    color: var(--success);
}

.toast-icon.error {
    color: var(--danger);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
    }

    .header-left h1 {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .toolbar-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .slides-grid {
        grid-template-columns: 1fr;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .modal {
        border-radius: var(--radius-md);
    }
}