/* ============================================
   Watch Admin Console Styles
   ============================================ */

:root {
    --admin-bg: #f4f4f6;
    --admin-surface: #ffffff;
    --admin-primary: #8b5cf6;
    --admin-primary-dark: #7c3aed;
    --admin-danger: #ef4444;
    --admin-success: #10b981;
    --admin-text: #1f2937;
    --admin-text-muted: #6b7280;
    --admin-border: #e5e7eb;
    --admin-shadow: rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
}

/* ============================================
   Layout
   ============================================ */

.admin-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    box-shadow: 0 2px 8px var(--admin-shadow);
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user-email {
    color: var(--admin-text-muted);
    font-size: 0.9rem;
}

/* Admin Mode Tabs */
.admin-tabs {
    display: flex;
    gap: 0;
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-border);
    padding: 0 24px;
}

.admin-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--admin-text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.admin-tab:hover {
    color: var(--admin-text);
    background: rgba(139, 92, 246, 0.05);
}

.admin-tab.active {
    color: var(--admin-primary);
    border-bottom-color: var(--admin-primary);
}

/* Take Notes Specific Styles */
#notes-preview-container {
    flex-direction: column;
    justify-content: flex-start;
    gap: 20px;
}

.notes-video-wrapper {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

.notes-video-wrapper iframe {
    width: 100%;
    border-radius: 8px;
    aspect-ratio: 16/9;
}

.notes-audio-wrapper {
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
}

.notes-audio-wrapper audio {
    width: 100%;
    margin-bottom: 16px;
}

.notes-transcript-preview {
    background: var(--admin-bg);
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.notes-transcript-preview h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--admin-text-muted);
}

.notes-transcript-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--admin-text);
}

.admin-main {
    display: grid;
    grid-template-columns: 280px 1fr 360px;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.admin-column {
    display: flex;
    flex-direction: column;
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    overflow: hidden;
}

.admin-column:last-child {
    border-right: none;
}

.admin-column-header {
    padding: 16px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-column-header h2 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ============================================
   Video List (Left Column)
   ============================================ */

.admin-column--videos {
    background: #f9fafb;
}

.admin-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.admin-search:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.admin-video-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.admin-video-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--admin-surface);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-video-item:hover {
    border-color: var(--admin-primary);
}

.admin-video-item.selected {
    border-color: var(--admin-primary);
    background: #f5f3ff;
}

.admin-video-item-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.admin-video-item-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-video-item-level.beginner {
    background: #d1fae5;
    color: #065f46;
}

.admin-video-item-level.intermediate {
    background: #fef3c7;
    color: #92400e;
}

.admin-video-item-level.advanced {
    background: #fee2e2;
    color: #991b1b;
}

.admin-video-item-questions {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--admin-text-muted);
}

.admin-loading {
    padding: 20px;
    text-align: center;
    color: var(--admin-text-muted);
}

/* Sync Status */
.admin-sync-status {
    padding: 10px 16px;
    margin: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.admin-sync-status.success {
    background: #d1fae5;
    color: #065f46;
}

.admin-sync-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.admin-sync-status.loading {
    background: #e0e7ff;
    color: #3730a3;
}

/* ============================================
   Player & Timeline (Center Column)
   ============================================ */

.admin-column--player {
    background: #1a1a2e;
    color: white;
}

.admin-column--player .admin-column-header {
    background: #16162a;
    border-bottom: 1px solid #2a2a40;
}

.admin-column--player .admin-column-header h2 {
    color: white;
    font-size: 1rem;
}

.admin-player-container {
    flex: 1;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.admin-youtube-player {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.admin-player-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 1rem;
}

/* Timeline */
.admin-timeline-container {
    padding: 16px;
    background: #16162a;
    border-top: 1px solid #2a2a40;
}

.admin-timeline-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-timeline-time {
    font-size: 0.9rem;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
}

.admin-timeline {
    position: relative;
    height: 12px;
    background: #374151;
    border-radius: 6px;
    cursor: pointer;
}

.admin-timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--admin-primary), var(--admin-primary-dark));
    border-radius: 6px;
    width: 0%;
    transition: width 0.25s;
}

.admin-timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
}

.admin-timeline-marker {
    position: absolute;
    top: -6px;
    width: 24px;
    height: 24px;
    background: #f59e0b;
    border: 3px solid white;
    border-radius: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 2;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
}

.admin-timeline-marker:hover {
    transform: translateX(-50%) scale(1.2);
}

.admin-timeline-marker.selected {
    background: var(--admin-primary);
}

.admin-timeline-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* ============================================
   Question Editor (Right Column)
   ============================================ */

.admin-column--editor {
    overflow-y: auto;
}

.admin-question-editor {
    padding: 16px;
    flex: 1;
}

.admin-editor-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--admin-text-muted);
    text-align: center;
}

.admin-question-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--admin-text);
}

.admin-form-group--row {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
}

.admin-form-group--row .admin-form-field {
    flex: 1;
}

.admin-form-group--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.admin-form-group--checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.admin-form-group--checkbox label {
    cursor: pointer;
}

.admin-input {
    padding: 10px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.admin-input:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.admin-input--readonly {
    background: #f9fafb;
    color: var(--admin-text-muted);
}

textarea.admin-input {
    resize: vertical;
    min-height: 60px;
}

.admin-form-section {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-form-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--admin-text-muted);
}

/* MC Options */
.admin-mc-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.admin-mc-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-mc-option-label {
    width: 24px;
    height: 24px;
    background: var(--admin-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.admin-mc-option input {
    flex: 1;
}

.admin-mc-option-remove {
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--admin-danger);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Form Actions */
.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--admin-border);
}

/* ============================================
   Buttons
   ============================================ */

.admin-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.admin-btn--primary {
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
    color: white;
}

.admin-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.admin-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.admin-btn--secondary {
    background: #f3f4f6;
    color: var(--admin-text);
}

.admin-btn--secondary:hover {
    background: #e5e7eb;
}

.admin-btn--danger {
    background: var(--admin-danger);
    color: white;
}

.admin-btn--danger:hover {
    background: #dc2626;
}

.admin-btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: #374151;
    color: white;
}

.admin-btn--icon:hover {
    background: #4b5563;
}

.admin-btn--small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ============================================
   Modals
   ============================================ */

.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.admin-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.admin-modal-content h3 {
    margin: 0 0 12px 0;
}

.admin-modal-content p {
    margin: 0 0 20px 0;
    color: var(--admin-text-muted);
}

.admin-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1200px) {
    .admin-main {
        grid-template-columns: 220px 1fr 300px;
    }
}

@media (max-width: 900px) {
    .admin-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .admin-column {
        border-right: none;
        border-bottom: 1px solid var(--admin-border);
    }

    .admin-column--videos {
        max-height: 200px;
    }

    .admin-column--editor {
        max-height: 400px;
    }
}

/* ============================================
   Question List (in Editor Panel)
   ============================================ */

.admin-question-list {
    margin-bottom: 20px;
}

.admin-question-list h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-question-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.admin-question-item:hover {
    background: #ede9fe;
    border-color: var(--admin-primary);
}

.admin-question-item.selected {
    background: #ede9fe;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.admin-question-number {
    font-weight: 600;
    color: var(--admin-primary);
    min-width: 28px;
}

.admin-question-time {
    font-family: monospace;
    background: var(--admin-surface);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--admin-text-muted);
    border: 1px solid var(--admin-border);
}

.admin-question-preview {
    flex: 1;
    font-size: 13px;
    color: var(--admin-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-question-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--admin-primary);
    color: white;
}
/* Toast Notifications */
.admin-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
}

.admin-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-info { border-left: 4px solid var(--admin-primary); }
.toast-success { border-left: 4px solid var(--admin-success); }
.toast-error { border-left: 4px solid var(--admin-danger); }
.toast-warning { border-left: 4px solid #f59e0b; }
