/**
 * Media Editor Styles
 * Unified editor for images and videos
 */

.scp-media-editor-modal {
    z-index: 100000;
}

.scp-media-editor-content {
    max-width: 95vw;
    width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.scp-media-editor-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 600px;
}

.scp-editor-sidebar {
    width: 280px;
    background: var(--scp-card-background, #f9fafb);
    border-right: 1px solid var(--scp-border-color, #e5e7eb);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.scp-editor-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--scp-border-color, #e5e7eb);
    padding: 8px;
    gap: 4px;
}

.scp-editor-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--scp-text-secondary, #6b7280);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.scp-editor-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--scp-primary-color, #667eea);
}

.scp-editor-tab.active {
    background: var(--scp-primary-color, #667eea);
    color: #ffffff;
}

.scp-editor-tab .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.scp-editor-panel {
    display: none;
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.scp-editor-panel.active {
    display: block;
}

.scp-editor-panel h3 {
    margin: 0 0 15px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--scp-text, #111827);
}

.scp-editor-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--scp-card-background, #ffffff);
    position: relative;
    overflow: auto;
}

.scp-editor-canvas-wrapper {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scp-editor-canvas-wrapper img,
.scp-editor-canvas-wrapper video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scp-editor-canvas {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scp-editor-preview-controls {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

.scp-video-timeline {
    flex: 1;
}

.scp-timeline-slider {
    width: 100%;
}

.scp-video-time {
    font-size: 0.85rem;
    color: var(--scp-text-secondary, #6b7280);
    white-space: nowrap;
}

.scp-editor-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--scp-border-color, #e5e7eb);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--scp-card-background, #ffffff);
}

/* Filter Controls */
.scp-filter-control {
    margin-bottom: 20px;
}

.scp-filter-control label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--scp-text, #111827);
}

.scp-filter-slider {
    width: 100%;
    margin-bottom: 5px;
}

.scp-filter-value {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--scp-text-secondary, #6b7280);
    margin-left: 8px;
}

.scp-filter-presets {
    margin-bottom: 20px;
}

.scp-filter-preset {
    display: inline-block;
    width: 60px;
    height: 60px;
    margin: 5px;
    border: 2px solid var(--scp-border-color, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}

.scp-filter-preset:hover {
    border-color: var(--scp-primary-color, #667eea);
    transform: scale(1.05);
}

.scp-filter-preset.active {
    border-color: var(--scp-primary-color, #667eea);
    border-width: 3px;
}

.scp-filter-preview {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.scp-filter-preset span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 4px;
    text-align: center;
}

/* Crop Controls */
.scp-crop-control {
    margin-bottom: 15px;
}

.scp-editor-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
}

.scp-crop-control .button {
    width: 48%;
    margin-right: 2%;
    font-size: 0.85rem;
    padding: 8px 12px;
}

.scp-crop-control .button:last-child {
    margin-right: 0;
}

/* Text Controls */
.scp-text-control {
    margin-bottom: 15px;
}

.scp-text-control textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
    resize: vertical;
}

.scp-color-picker {
    width: 100%;
    height: 40px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    cursor: pointer;
}

.scp-text-overlays-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--scp-border-color, #e5e7eb);
}

.scp-text-overlay-item {
    padding: 10px;
    background: var(--scp-card-background, #ffffff);
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scp-text-overlay-item span {
    flex: 1;
    font-size: 0.9rem;
}

.scp-remove-text-overlay {
    color: #dc2626;
    text-decoration: none;
    font-size: 0.85rem;
}

.scp-remove-text-overlay:hover {
    text-decoration: underline;
}

/* Video Controls */
.scp-trim-control,
.scp-music-control,
.scp-speed-control {
    margin-bottom: 15px;
}

.scp-trim-input {
    width: 80px;
    padding: 6px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 4px;
    margin-right: 8px;
}

.scp-trim-timeline {
    margin-top: 15px;
    height: 60px;
    background: var(--scp-card-background, #f3f4f6);
    border-radius: 6px;
    position: relative;
}

.scp-timeline-track {
    width: 100%;
    height: 100%;
    position: relative;
}

.scp-timeline-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--scp-primary-color, #667eea);
    cursor: ew-resize;
}

.scp-timeline-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--scp-primary-color, #667eea);
    border-radius: 50%;
    border: 2px solid #fff;
}

.scp-speed-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.scp-speed-preset {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    background: var(--scp-card-background, #ffffff);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scp-speed-preset:hover {
    border-color: var(--scp-primary-color, #667eea);
}

.scp-speed-preset.active {
    background: var(--scp-primary-color, #667eea);
    color: #fff;
    border-color: var(--scp-primary-color, #667eea);
}

.scp-music-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
}

.scp-music-library {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--scp-border-color, #e5e7eb);
}

.scp-music-tracks {
    max-height: 200px;
    overflow-y: auto;
}

.scp-music-track {
    padding: 10px;
    background: var(--scp-card-background, #ffffff);
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scp-music-track:hover {
    border-color: var(--scp-primary-color, #667eea);
    background: rgba(102, 126, 234, 0.05);
}

/* Stickers */
.scp-stickers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.scp-sticker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: var(--scp-card-background, #ffffff);
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scp-sticker-item:hover {
    border-color: var(--scp-primary-color, #667eea);
    transform: scale(1.1);
}

.scp-sticker-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--scp-border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .scp-media-editor-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .scp-media-editor-wrapper {
        flex-direction: column;
    }
    
    .scp-editor-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--scp-border-color, #e5e7eb);
    }
    
    .scp-editor-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .scp-editor-tab {
        min-width: 70px;
        font-size: 0.75rem;
        padding: 8px 6px;
    }
    
    .scp-editor-preview {
        flex: 1;
        min-height: 300px;
    }
}

/* Dark Mode */
body.scp-dark-mode-active .scp-editor-sidebar,
html.scp-dark-mode-active .scp-editor-sidebar {
    background: var(--scp-card-background, #18191a);
    border-color: var(--scp-border-color, #3a3b3c);
}

body.scp-dark-mode-active .scp-editor-preview,
html.scp-dark-mode-active .scp-editor-preview {
    background: var(--scp-card-background, #18191a);
}
