/**
 * Content Creator Canvas Styles
 * Full-screen overlay content creation studio
 * Responsive: Desktop split-panel, Mobile stacked
 */

/* ============================================
   Create New Button (on media content page)
   ============================================ */
.cc-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 12px 0 4px;
}

.cc-open-btn:hover {
    box-shadow: 0 4px 16px rgba(14, 19, 105, 0.35);
    transform: translateY(-1px);
}

.cc-open-btn i {
    font-size: 1rem;
}

/* ============================================
   Canvas Overlay (Full-screen)
   ============================================ */
.content-canvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    display: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    animation: ccFadeIn 0.2s ease;
}

.content-canvas-overlay.active {
    display: flex;
}

@keyframes ccFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   Canvas Container
   ============================================ */
.content-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 94vw;
    height: 92vh;
    max-width: 1400px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    animation: ccSlideUp 0.3s ease;
}

@keyframes ccSlideUp {
    from { transform: translate(-50%, -48%); opacity: 0; }
    to { transform: translate(-50%, -50%); opacity: 1; }
}

/* ============================================
   Resize Handle
   ============================================ */
.cc-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    color: #94a3b8;
    font-size: 0.65rem;
    z-index: 10;
    border-radius: 8px 0 16px 0;
    transition: color 0.2s, background 0.2s;
}

.cc-resize-handle:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.cc-resize-handle i {
    transform: rotate(-45deg);
}

@media (max-width: 768px) {
    .cc-resize-handle {
        display: none;
    }
}

/* ============================================
   Canvas Header
   ============================================ */
.cc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    flex-shrink: 0;
}

.cc-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cc-header-title {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.cc-header-title i {
    font-size: 1.25rem;
}

/* Build Your Templates heading */
.cc-build-templates {
    padding-bottom: 4px;
}

.cc-build-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0e1369;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.cc-tab-switcher {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
}

.cc-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 1;
    padding: 9px 16px;
    border: none;
    background: transparent;
    border-radius: 7px;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-tab-btn:hover {
    color: #0e1369;
    background: rgba(14, 19, 105, 0.06);
}

.cc-tab-btn.active {
    background: white;
    color: #0e1369;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Header Center — Template Name */
.cc-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
    padding: 0 16px;
}

.cc-template-name-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    padding: 8px 14px;
    width: 100%;
    max-width: 380px;
    position: relative;
}

.cc-template-name-wrap > i:first-child {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    flex-shrink: 0;
}

.cc-template-name-input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 1.15rem;
    font-weight: 600;
    width: 100%;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.cc-template-name-input::-webkit-search-cancel-button,
.cc-template-name-input::-webkit-search-decoration,
.cc-template-name-input::-webkit-search-results-button,
.cc-template-name-input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
}

.cc-template-name-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

/* Template Chevron */
.cc-template-chevron {
    cursor: pointer;
    transition: transform 0.2s ease;
    font-size: 0.7rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
}

.cc-template-chevron.open {
    transform: rotate(180deg);
}

.cc-template-chevron:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Template Dropdown */

.cc-template-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
}

.cc-template-dropdown.visible {
    display: block;
    animation: ccDropIn 0.15s ease;
}

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

.cc-tpl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.cc-tpl-item:last-child {
    border-bottom: none;
}

.cc-tpl-item:hover {
    background: #f0f4ff;
}

.cc-tpl-item:first-child {
    border-radius: 10px 10px 0 0;
}

.cc-tpl-item:last-child {
    border-radius: 0 0 10px 10px;
}

.cc-tpl-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cc-tpl-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-tpl-complete {
    color: #059669;
    font-size: 0.8rem;
}

.cc-tpl-partial {
    color: #f59e0b;
    font-size: 0.8rem;
}

.cc-tpl-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cc-tpl-item-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cc-tpl-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    padding: 0;
}

.cc-tpl-item:hover .cc-tpl-delete-btn {
    opacity: 1;
}

.cc-tpl-delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.cc-tpl-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 0.65rem;
}

.cc-tpl-badge.img {
    background: rgba(14, 19, 105, 0.08);
    color: #0e1369;
}

.cc-tpl-badge.vid {
    background: rgba(146, 64, 14, 0.08);
    color: #92400e;
}

.cc-tpl-new {
    border-bottom: 2px solid #e2e8f0 !important;
}

.cc-tpl-new-icon {
    color: #0e1369;
    font-size: 0.9rem;
}

.cc-tpl-new .cc-tpl-item-name {
    color: #0e1369;
    font-weight: 600;
}

.cc-tpl-new:hover {
    background: #eef2ff;
}

.cc-tpl-empty {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
}

.cc-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-niche-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.cc-niche-badge i {
    font-size: 0.85rem;
}

.cc-minimize-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.cc-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Minimized Bubble
   ============================================ */
.cc-minimized-bubble {
    position: fixed;
    bottom: 24px;
    right: 90px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    border-radius: 50px;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 20px rgba(14, 19, 105, 0.4);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    font-family: inherit;
}

.cc-minimized-bubble:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 30px rgba(14, 19, 105, 0.5);
}

.cc-mini-bubble-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.cc-mini-bubble-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.cc-mini-bubble-icon.rendering {
    color: #fbbf24;
}

.cc-mini-bubble-icon.complete {
    color: #34d399;
    font-size: 1.2rem;
}

.cc-mini-bubble-label {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.cc-mini-bubble-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ccBadgePulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

@keyframes ccBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.cc-mini-bubble-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cc-mini-bubble-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: scale(1.15);
}

@media (max-width: 768px) {
    .cc-minimized-bubble {
        bottom: 16px;
        right: 16px;
        padding: 8px 14px;
    }

    .cc-mini-bubble-close {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}

/* ============================================
   Canvas Body (Split Panel)
   ============================================ */
.cc-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   Control Panel (Left Side)
   ============================================ */
.cc-controls {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
    background: #fafbfc;
    overflow-y: auto;
}

.cc-controls-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

/* Control Sections */
.cc-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cc-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lab Images Info Button */
.cc-lab-info-btn {
    font-size: 0.72rem;
    color: #94a3b8;
    cursor: pointer;
    margin-left: 4px;
    transition: color 0.2s ease;
}

.cc-lab-info-btn:hover {
    color: #0e1369;
}

/* Model Selector */
.cc-model-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.cc-model-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.cc-model-option:hover {
    border-color: #0e1369;
    background: #f8f9ff;
}

.cc-model-option.active {
    border-color: #0e1369;
    background: rgba(14, 19, 105, 0.05);
    box-shadow: 0 0 0 3px rgba(14, 19, 105, 0.1);
}

.cc-model-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.cc-model-icon.dalle { background: rgba(16, 163, 127, 0.1); color: #10a37f; }
.cc-model-icon.flux { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.cc-model-icon.nova { background: rgba(255, 153, 0, 0.1); color: #ff9900; }
.cc-model-icon.nova-reel { background: rgba(146, 64, 14, 0.1); color: #92400e; }
.cc-model-icon.kling { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.cc-model-icon.grok { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.cc-model-icon.sora { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.cc-model-icon.heygen { background: rgba(99, 102, 241, 0.1); color: #6366f1; }

.cc-model-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
}

.cc-model-desc {
    font-size: 0.7rem;
    color: #94a3b8;
    line-height: 1.3;
}

/* Model Dropdown Selector */
.cc-model-dropdown {
    position: relative;
}

.cc-model-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cc-model-dropdown-trigger:hover {
    border-color: #0e1369;
}

.cc-model-dropdown.open .cc-model-dropdown-trigger {
    border-color: #0e1369;
    box-shadow: 0 0 0 3px rgba(14, 19, 105, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cc-mdt-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.cc-mdt-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cc-mdt-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-mdt-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
}

.cc-mdt-type-tag {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 1px 6px;
    border-radius: 4px;
}

.cc-mdt-type-tag.image {
    background: rgba(14, 19, 105, 0.08);
    color: #0e1369;
}

.cc-mdt-type-tag.video {
    background: rgba(146, 64, 14, 0.08);
    color: #92400e;
}

.cc-mdt-cost {
    color: #059669;
    font-weight: 600;
    font-size: 0.7rem;
}

.cc-mdt-arrow {
    color: #94a3b8;
    font-size: 0.72rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.cc-model-dropdown.open .cc-mdt-arrow {
    transform: rotate(180deg);
}

/* Dropdown Panel */
.cc-model-dropdown-panel {
    display: none;
    position: fixed;
    z-index: 9999;
    width: auto;
    min-width: 340px;
    background: #fff;
    border: 2px solid #0e1369;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
}

.cc-model-dropdown.open .cc-model-dropdown-panel {
    display: block;
}

.cc-mt-group-row td {
    padding: 7px 10px !important;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0 !important;
    cursor: default !important;
}

.cc-mt-group-row:hover {
    background: transparent !important;
}

.cc-mt-group-row td i {
    font-size: 0.72rem;
    margin-right: 4px;
}

.cc-mt-dash {
    color: #94a3b8;
}

.cc-model-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.cc-model-table thead th {
    padding: 5px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.cc-model-table thead th:nth-child(3) {
    text-align: center;
}

.cc-model-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.cc-model-table tbody tr:hover {
    background: #f1f5f9;
}

.cc-model-table tbody td {
    padding: 7px 8px;
    vertical-align: middle;
    border-bottom: 1px solid #f8fafc;
    white-space: nowrap;
    color: #334155;
}

.cc-mt-spokes {
    text-align: center;
}

.cc-model-table tbody tr:last-child td {
    border-bottom: none;
}

/* Selected row */
.cc-model-row-selected {
    background: rgba(14, 19, 105, 0.06) !important;
    box-shadow: inset 3px 0 0 #0e1369;
}

.cc-model-row-selected td {
    color: #0e1369 !important;
    font-weight: 600;
}

/* Name cell with icon */
.cc-mt-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.cc-mt-name .cc-model-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 0.62rem;
}

/* Mode tags */
.cc-mt-mode-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
}

.cc-mt-mode-promo {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.cc-mt-mode-explainer {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.cc-mt-mode-cinematic {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
}

/* Spokesperson cell */
.cc-mt-spokes {
    text-align: center;
    font-size: 0.72rem;
}

.cc-mt-spokes i {
    color: #64748b;
}

.cc-model-row-selected .cc-mt-spokes i {
    color: #0e1369;
}

/* Length cell */
.cc-mt-length {
    font-size: 0.72rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

/* Cost cell */
.cc-mt-cost {
    font-size: 0.72rem;
    font-weight: 600;
    color: #059669;
    font-variant-numeric: tabular-nums;
}

.cc-model-row-selected .cc-mt-cost {
    color: #0e1369;
}

/* Dark mode - Dropdown */
body.dark-mode .cc-model-dropdown-trigger {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .cc-model-dropdown-trigger:hover {
    border-color: #818cf8;
}

body.dark-mode .cc-model-dropdown.open .cc-model-dropdown-trigger {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

body.dark-mode .cc-mdt-name {
    color: #e2e8f0;
}

body.dark-mode .cc-mdt-type-tag.image {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

body.dark-mode .cc-mdt-type-tag.video {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

body.dark-mode .cc-mdt-cost {
    color: #34d399;
}

body.dark-mode .cc-mdt-arrow {
    color: #64748b;
}

body.dark-mode .cc-model-dropdown-panel {
    background: #0f172a;
    border-color: #818cf8;
    border-top-color: #334155;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Dark mode - Table */
body.dark-mode .cc-mt-group-row td {
    background: #1e293b;
    border-color: #334155 !important;
    color: #94a3b8;
}

body.dark-mode .cc-model-table thead th {
    color: #64748b;
    border-color: #1e293b;
}

body.dark-mode .cc-model-table tbody tr:hover {
    background: #1e293b;
}

body.dark-mode .cc-model-table tbody td {
    color: #cbd5e1;
    border-color: #1e293b;
}

body.dark-mode .cc-model-row-selected {
    background: rgba(99, 102, 241, 0.1) !important;
    box-shadow: inset 3px 0 0 #818cf8;
}

body.dark-mode .cc-model-row-selected td {
    color: #a5b4fc !important;
}

body.dark-mode .cc-mt-spokes i {
    color: #94a3b8;
}

body.dark-mode .cc-model-row-selected .cc-mt-spokes i {
    color: #a5b4fc;
}

body.dark-mode .cc-mt-cost {
    color: #34d399;
}

body.dark-mode .cc-model-row-selected .cc-mt-cost {
    color: #a5b4fc;
}

body.dark-mode .cc-mt-mode-promo {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

body.dark-mode .cc-mt-mode-explainer {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

body.dark-mode .cc-mt-mode-cinematic {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

/* Reference Images */
.cc-ref-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.cc-ref-upload-area:hover {
    border-color: #0e1369;
    background: #f8f9ff;
}

.cc-ref-upload-area.dragover {
    border-color: #0e1369;
    background: rgba(14, 19, 105, 0.05);
}

.cc-ref-upload-icon {
    font-size: 1.5rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.cc-ref-upload-text {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
}

.cc-ref-upload-text span {
    color: #0e1369;
    font-weight: 600;
}

.cc-ref-previews {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-ref-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.cc-ref-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cc-ref-thumb-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Step Numbers */
.cc-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #0e1369;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Video Style Row — large full-width buttons */
.cc-video-style-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.cc-video-style-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-video-style-btn i {
    font-size: 1rem;
}

.cc-video-style-btn:hover {
    border-color: #0e1369;
    color: #0e1369;
}

.cc-video-style-btn.active {
    background: #0e1369;
    border-color: #0e1369;
    color: white;
    box-shadow: 0 2px 8px rgba(14, 19, 105, 0.25);
}

body.dark-mode .cc-video-style-btn {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .cc-video-style-btn.active {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}

body.dark-mode .cc-step-number {
    background: #1e40af;
}

/* Style Presets */
.cc-style-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cc-style-chip {
    padding: 6px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-style-chip:hover {
    border-color: #0e1369;
    color: #0e1369;
}

.cc-style-chip.active {
    background: #0e1369;
    border-color: #0e1369;
    color: white;
}

/* Settings Row */
.cc-settings-row {
    display: flex;
    gap: 10px;
}

.cc-setting {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cc-setting label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.cc-setting select {
    padding: 8px 28px 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    color: #1e293b;
}

.cc-setting select:focus {
    outline: none;
    border-color: #0e1369;
    box-shadow: 0 0 0 3px rgba(14, 19, 105, 0.1);
}

/* Niche Style Toggle */
.cc-niche-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(14, 19, 105, 0.04);
    border: 1px solid rgba(14, 19, 105, 0.1);
    border-radius: 10px;
}

.cc-niche-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-niche-toggle-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.cc-niche-toggle-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
}

.cc-niche-toggle-sub {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 400;
}

/* Toggle Switch */
.cc-toggle {
    position: relative;
    width: 40px;
    height: 22px;
}

.cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    border-radius: 22px;
    transition: 0.2s;
}

.cc-toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
}

.cc-toggle input:checked + .cc-toggle-slider {
    background-color: #0e1369;
}

.cc-toggle input:checked + .cc-toggle-slider:before {
    transform: translateX(18px);
}

/* Prompt Area */
.cc-prompt-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.cc-prompt-wrapper {
    position: relative;
}

.cc-prompt-input {
    width: 100%;
    min-height: 80px;
    max-height: 160px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    color: #1e293b;
    background: white;
    box-sizing: border-box;
}

.cc-prompt-input:focus {
    outline: none;
    border-color: #0e1369;
    box-shadow: 0 0 0 3px rgba(14, 19, 105, 0.1);
}

.cc-prompt-input::placeholder {
    color: #94a3b8;
}

/* Button Stack (Generate + Save Template) */
.cc-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cc-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-template-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    color: #0e1369;
    border: 2px solid #0e1369;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-template-btn:hover {
    background: rgba(14, 19, 105, 0.06);
    box-shadow: 0 2px 8px rgba(14, 19, 105, 0.15);
}

.cc-template-btn:disabled {
    cursor: default;
}

.cc-template-btn.confirmed {
    background: #059669;
    border-color: #059669;
    color: white;
}

.cc-template-btn.needs-update {
    background: #e8564a;
    border-color: #e8564a;
    color: white;
    animation: cc-pulse-attention 1.5s ease-in-out 1;
}

@keyframes cc-pulse-attention {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.cc-template-btn i {
    font-size: 0.9rem;
}

.cc-generate-btn:hover {
    box-shadow: 0 4px 16px rgba(14, 19, 105, 0.35);
    transform: translateY(-1px);
}

.cc-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cc-generate-btn i {
    font-size: 1rem;
}

/* ============================================
   Preview Panel (Right Side)
   ============================================ */
.cc-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

.cc-preview-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

/* Empty State */
.cc-preview-empty {
    text-align: center;
    color: #94a3b8;
}

.cc-preview-empty-icon {
    width: 80px;
    height: 80px;
    background: #e2e8f0;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
    color: #94a3b8;
}

.cc-preview-empty h3 {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 6px;
}

.cc-preview-empty p {
    font-size: 0.85rem;
    color: #94a3b8;
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.4;
}

/* Generated Output */
.cc-preview-result {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 0;
}

.cc-preview-result img {
    flex: 1 1 0;
    min-height: 0;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.cc-preview-result video {
    flex: 1 1 0;
    min-height: 0;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

/* Preview Actions */
.cc-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 0;
}

.cc-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cc-action-btn:hover {
    border-color: #0e1369;
    color: #0e1369;
    background: #f8f9ff;
}

.cc-action-btn.primary {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    border-color: transparent;
    color: white;
}

.cc-action-btn.primary:hover {
    box-shadow: 0 2px 10px rgba(14, 19, 105, 0.3);
}

.cc-action-btn.cc-save-lab-btn {
    background: linear-gradient(135deg, #059669 0%, #06b8a0 100%);
    border-color: transparent;
    color: white;
}

.cc-action-btn.cc-save-lab-btn:hover {
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3);
}

/* Loading State */
.cc-preview-loading {
    text-align: center;
    color: #64748b;
}

.cc-loading-spinner {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: ccPulse 1.5s ease infinite;
}

.cc-loading-spinner i {
    font-size: 1.5rem;
    color: white;
    animation: ccSpin 1s linear infinite;
}

@keyframes ccPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes ccSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.cc-preview-loading p {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.cc-preview-loading span {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Video Progress UI */
.cc-video-progress {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.cc-vp-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
}

.cc-vp-icon i {
    font-size: 1.6rem;
    color: white;
    z-index: 1;
}

.cc-vp-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    animation: ccVpShimmer 2s ease infinite;
}

@keyframes ccVpShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.cc-vp-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.cc-vp-subtitle {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-bottom: 20px;
}

/* Progress bar */
.cc-vp-bar-wrap {
    background: #e2e8f0;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 14px;
    position: relative;
}

.cc-vp-bar {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #0e1369 0%, #3b82f6 100%);
    transition: width 1s ease;
    position: relative;
}

.cc-vp-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: ccVpBarShine 1.5s ease infinite;
}

@keyframes ccVpBarShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Phase indicators */
.cc-vp-phases {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 2px;
}

.cc-vp-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.35;
    transition: all 0.4s ease;
}

.cc-vp-phase.active {
    opacity: 1;
}

.cc-vp-phase.done {
    opacity: 0.6;
}

.cc-vp-phase-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: #94a3b8;
    transition: all 0.4s ease;
}

.cc-vp-phase.active .cc-vp-phase-dot {
    background: linear-gradient(135deg, #0e1369 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 0 0 4px rgba(14, 19, 105, 0.15);
}

.cc-vp-phase.done .cc-vp-phase-dot {
    background: #10b981;
    color: white;
}

.cc-vp-phase-label {
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

/* Status message */
.cc-vp-status {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-vp-status i {
    color: #3b82f6;
    font-size: 0.9rem;
    animation: ccPulse 1.5s ease infinite;
}

.cc-vp-status-text {
    font-size: 0.8rem;
    color: #475569;
    text-align: left;
    line-height: 1.4;
}

.cc-vp-time {
    font-weight: 600;
    color: #0e1369;
}

body.dark-mode .cc-vp-title { color: #e2e8f0; }
body.dark-mode .cc-vp-bar-wrap { background: #334155; }
body.dark-mode .cc-vp-status { background: #1e293b; }
body.dark-mode .cc-vp-status-text { color: #94a3b8; }
body.dark-mode .cc-vp-phase-dot { background: #334155; }
body.dark-mode .cc-vp-phase-label { color: #94a3b8; }

.cc-cancel-render-btn {
    margin-top: 16px;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}
.cc-cancel-render-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}
body.dark-mode .cc-cancel-render-btn {
    border-color: #334155;
    color: #94a3b8;
}
body.dark-mode .cc-cancel-render-btn:hover {
    background: #450a0a;
    border-color: #dc2626;
    color: #fca5a5;
}

/* ============================================
   History Strip (Bottom of Preview)
   ============================================ */
.cc-history {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
    overflow-x: auto;
    flex-shrink: 0;
}

.cc-history:empty {
    display: none;
}

.cc-history-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.cc-history-items {
    display: flex;
    gap: 6px;
}

.cc-history-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cc-history-thumb:hover {
    border-color: #0e1369;
}

.cc-history-thumb.active {
    border-color: #0e1369;
    box-shadow: 0 0 0 2px rgba(14, 19, 105, 0.2);
}

.cc-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Video-specific Controls
   ============================================ */
.cc-video-controls {
    display: none;
}

.cc-body[data-tab="video"] .cc-video-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cc-body[data-tab="video"] .cc-image-controls {
    display: none;
}

/* ============================================
   Responsive - Tablet (< 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .content-canvas {
        width: 98vw;
        height: 95vh;
    }

    .cc-controls {
        width: 320px;
    }
}

/* ============================================
   Responsive - Mobile (< 768px)
   ============================================ */
@media (max-width: 768px) {
    .content-canvas {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: none;
        box-sizing: border-box;
        animation: ccSlideUpMobile 0.3s ease;
    }

    @keyframes ccSlideUpMobile {
        from { transform: translateY(20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .cc-header {
        padding: 16px 12px;
        flex-wrap: nowrap;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
        position: relative;
        z-index: 10;
    }

    .cc-header-left {
        flex: 0 0 auto;
        gap: 0;
    }

    .cc-header-title {
        font-size: 1.1rem;
        gap: 0;
    }

    .cc-header-title .cc-title-text {
        display: none;
    }

    .cc-header-center {
        flex: 1 1 0;
        padding: 0;
        min-width: 0;
    }

    .cc-template-name-wrap {
        padding: 10px 12px;
        gap: 8px;
        max-width: none;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .cc-template-name-input {
        font-size: 0.95rem;
        font-weight: 500;
        min-width: 0;
        flex: 1 1 auto;
        text-overflow: ellipsis;
    }

    .cc-template-name-wrap > i:first-child {
        display: none;
    }

    .cc-template-chevron {
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    .cc-template-dropdown {
        z-index: 9999;
    }

    .cc-tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .cc-niche-badge {
        display: none;
    }

    .cc-header-right {
        flex: 0 0 auto;
    }

    .cc-close-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .cc-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .cc-controls {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        overflow-y: visible;
        flex-shrink: 0;
    }

    .cc-controls-inner {
        padding: 16px;
        gap: 16px;
    }

    .cc-prompt-area {
        margin-top: 0;
    }

    .cc-preview {
        min-height: 300px;
    }

    .cc-preview-main {
        padding: 16px;
    }

    .cc-preview-empty-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .cc-history {
        padding: 10px 16px;
    }

    .cc-history-thumb {
        width: 40px;
        height: 40px;
    }

    .cc-settings-row {
        flex-direction: column;
    }

    .cc-preview-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   Responsive - Small Mobile (< 400px)
   ============================================ */
@media (max-width: 400px) {
    .cc-model-grid {
        grid-template-columns: 1fr;
    }

    .cc-style-chip {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */
body.dark-mode .content-canvas {
    background: #0f172a;
}

body.dark-mode .cc-controls {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .cc-section-label {
    color: #94a3b8;
}

body.dark-mode .cc-model-option {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .cc-model-option:hover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.05);
}

body.dark-mode .cc-model-option.active {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

body.dark-mode .cc-model-name {
    color: #e2e8f0;
}

body.dark-mode .cc-style-chip {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .cc-style-chip.active {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}

body.dark-mode .cc-ref-upload-area {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .cc-setting select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .cc-prompt-input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .cc-niche-toggle {
    background: rgba(96, 165, 250, 0.05);
    border-color: rgba(96, 165, 250, 0.15);
}

body.dark-mode .cc-niche-toggle-text {
    color: #e2e8f0;
}

body.dark-mode .cc-preview {
    background: #0f172a;
}

body.dark-mode .cc-preview-empty-icon {
    background: #334155;
}

body.dark-mode .cc-action-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .cc-action-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
}

body.dark-mode .cc-history {
    background: #1e293b;
    border-color: #334155;
}

/* ============================================
   Text in Image Controls
   ============================================ */
.cc-text-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    color: #1e293b;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cc-text-input:focus {
    outline: none;
    border-color: #0e1369;
    box-shadow: 0 0 0 3px rgba(14, 19, 105, 0.1);
}

.cc-text-tip {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cc-text-tip i {
    color: #cbd5e1;
    font-size: 0.7rem;
}

body.dark-mode .cc-text-input {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .cc-text-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.cc-text-overlay-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.cc-text-overlay-settings .cc-setting label {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 3px;
    display: block;
}

.cc-text-overlay-settings .cc-setting select {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1e293b;
}

body.dark-mode .cc-text-overlay-settings .cc-setting select {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

/* ============================================
   Confirm Dialog
   ============================================ */

.cc-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cc-confirm-overlay.active {
    opacity: 1;
}

.cc-confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 28px 32px 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.92);
    transition: transform 0.2s ease;
}

.cc-confirm-overlay.active .cc-confirm-dialog {
    transform: scale(1);
}

.cc-confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 auto 16px;
}

.cc-confirm-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}

.cc-confirm-message {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 22px;
}

.cc-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.cc-confirm-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
}

.cc-confirm-btn:active {
    transform: scale(0.97);
}

.cc-confirm-cancel {
    background: #f1f5f9;
    color: #475569;
}

.cc-confirm-cancel:hover {
    background: #e2e8f0;
}

.cc-confirm-delete {
    background: #dc2626;
    color: white;
}

.cc-confirm-delete:hover {
    background: #b91c1c;
}

/* ============================================
   SCENE EDITOR
   ============================================ */

.scene-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px;
}

.scene-editor-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scene-editor-header h3 i {
    color: #06b8a0;
}

.scene-editor-subtitle {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.scene-clips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.scene-clip-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.scene-clip-card:hover {
    border-color: #06b8a0;
    box-shadow: 0 2px 8px rgba(6, 184, 160, 0.1);
}

.scene-clip-card.regenerating {
    border-color: #f59e0b;
    opacity: 0.85;
}

.scene-clip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #f1f5f9;
}

.scene-clip-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.scene-clip-status {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #64748b;
}

.scene-clip-status.regenerating {
    background: #fef3c7;
    color: #92400e;
    animation: pulse-status 1.5s ease-in-out infinite;
}

.scene-clip-status.regenerated {
    background: #d1fae5;
    color: #065f46;
}

.scene-clip-status.kept {
    background: #dbeafe;
    color: #1e40af;
}

.scene-clip-status.error {
    background: #fee2e2;
    color: #991b1b;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.scene-clip-video {
    width: 100%;
    display: block;
    max-height: 180px;
    object-fit: contain;
    background: #0f172a;
}

.scene-clip-prompt {
    padding: 6px 10px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
    min-height: 32px;
    border-top: 1px solid #e2e8f0;
}

.scene-clip-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid #e2e8f0;
}

.scene-clip-actions .cc-action-btn {
    flex: 1;
    font-size: 11px;
    padding: 5px 8px;
    justify-content: center;
}

.scene-keep-btn.active {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.scene-regen-btn {
    background: #fff7ed !important;
    color: #c2410c !important;
    border-color: #fed7aa !important;
}

.scene-regen-btn:hover {
    background: #ffedd5 !important;
}

/* Scene editor footer */
.scene-editor-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scene-final-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scene-final-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.scene-final-video {
    width: 100%;
    max-height: 260px;
    border-radius: 8px;
    background: #0f172a;
    object-fit: contain;
}

.scene-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scene-finalize-btn {
    flex: 1;
    min-width: 160px;
}

.scene-finalize-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   Spokesperson Picker
   ============================================ */

.cc-spokesperson-picker {
    border-radius: 10px;
    overflow: hidden;
}

.cc-spokesperson-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.cc-spokesperson-empty:hover {
    border-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.cc-spokesperson-empty-icon {
    font-size: 24px;
    color: #6366f1;
    margin-bottom: 8px;
}

.cc-spokesperson-empty-text {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.cc-spokesperson-empty-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.cc-spokesperson-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 2px solid #6366f1;
    border-radius: 10px;
}

.cc-spokesperson-selected img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #6366f1;
}

.cc-spokesperson-info {
    flex: 1;
    min-width: 0;
}

.cc-spokesperson-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.cc-spokesperson-desc {
    font-size: 11px;
    color: #64748b;
}

.cc-spokesperson-actions {
    display: flex;
    gap: 4px;
}

.cc-spokesperson-actions button {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
}

.cc-spokesperson-change {
    background: #e0e7ff;
    color: #4338ca;
}

.cc-spokesperson-change:hover {
    background: #c7d2fe;
}

.cc-spokesperson-remove {
    background: #fef2f2;
    color: #dc2626;
}

.cc-spokesperson-remove:hover {
    background: #fee2e2;
}

/* ============================================
   Spokesperson Gallery Modal
   ============================================ */

.cc-spokesperson-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: ccSpFadeIn 0.2s ease;
}

@keyframes ccSpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cc-spokesperson-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
    max-width: 680px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: ccSpSlideUp 0.25s ease;
}

@keyframes ccSpSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cc-spokesperson-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.cc-spokesperson-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-spokesperson-modal-header h3 i {
    color: #6366f1;
}

.cc-spokesperson-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cc-spokesperson-modal-close:hover {
    background: #f1f5f9;
    color: #334155;
}

.cc-spokesperson-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.cc-spokesperson-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.cc-spokesperson-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: #fff;
}

.cc-spokesperson-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.cc-spokesperson-card.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.cc-spokesperson-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #f1f5f9;
    overflow: hidden;
}

.cc-spokesperson-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cc-spokesperson-card-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 20px;
    background: #f1f5f9;
}

.cc-spokesperson-card-info {
    padding: 8px 10px;
    text-align: center;
}

.cc-spokesperson-card-name {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.cc-spokesperson-card-desc {
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}

.cc-spokesperson-card-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

@media (max-width: 640px) {
    .cc-spokesperson-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .cc-spokesperson-modal {
        max-height: 90vh;
    }
}

/* ============================================
   Scene Selector (Cinematic Mode)
   ============================================ */

.cc-scene-section {
    margin-top: 4px;
}

.cc-scene-picker {
    border-radius: 10px;
    overflow: hidden;
}

.cc-scene-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 16px;
    background: linear-gradient(135deg, #1e1b4b08, #6366f108);
    border: 2px dashed rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.cc-scene-empty:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #1e1b4b12, #6366f112);
}

.cc-scene-empty-icon {
    font-size: 20px;
    color: #6366f1;
    margin-bottom: 6px;
}

.cc-scene-empty-text {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.cc-scene-empty-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.cc-scene-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: linear-gradient(135deg, #f0f9ff, #eff6ff);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
}

.cc-scene-selected img {
    width: 80px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.cc-scene-info {
    flex: 1;
    min-width: 0;
}

.cc-scene-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-scene-desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-scene-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cc-scene-change,
.cc-scene-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
}

.cc-scene-change {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.cc-scene-change:hover {
    background: rgba(99, 102, 241, 0.2);
}

.cc-scene-remove {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.cc-scene-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Scene Gallery Modal */
.cc-scene-modal {
    max-width: 800px;
}

.cc-scene-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
}

.cc-scene-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: #f8fafc;
}

.cc-scene-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}

.cc-scene-card.selected {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cc-scene-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #e2e8f0;
    overflow: hidden;
}

.cc-scene-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-scene-card-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 18px;
}

.cc-scene-card-info {
    padding: 8px 10px 10px;
}

.cc-scene-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-scene-card-name i {
    margin-right: 4px;
    color: #6366f1;
    font-size: 11px;
}

.cc-scene-card-desc {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .cc-scene-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .cc-scene-modal {
        max-height: 90vh;
    }
}
