/**
 * AutoDyna Video Editor Styles
 * עיצוב מודרני ונקי לפלטפורמת יצירת הוידאו
 */

/* Variables */
:root {
    --primary-color: #007cba;
    --primary-dark: #005a87;
    --primary-light: #cce7f0;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #dc3545;
    --info-color: #17a2b8;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-dark: #343a40;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    
    --border-color: #dee2e6;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    
    --transition: all 0.3s ease;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

/* Base Styles */
.autodyna-container {
    font-family: var(--font-family);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Notifications */
.autodyna-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    max-width: 500px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 10px;
    transform: translateX(400px);
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

.autodyna-notification--success {
    background-color: var(--success-color);
    color: white;
}

.autodyna-notification--error {
    background-color: var(--error-color);
    color: white;
}

.autodyna-notification--warning {
    background-color: var(--warning-color);
    color: var(--text-primary);
}

.autodyna-notification--info {
    background-color: var(--info-color);
    color: white;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* Template Gallery */
#template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.template-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.template-card.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.template-preview {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.template-card:hover .template-preview img {
    transform: scale(1.05);
}

.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.template-card:hover .template-overlay {
    opacity: 1;
}

.btn-select-template {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-select-template:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.template-info {
    padding: 15px;
}

.template-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-duration {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 20px;
    min-height: 600px;
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Editor Preview */
.editor-preview {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.preview-container {
    position: relative;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
}

#preview-video {
    width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
}

.preview-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

/* Editor Sidebar */
.editor-sidebar {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

.customization-panel {
    height: 100%;
}

.customization-sections {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.customization-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.customization-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.customization-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Text Layers */
.text-layers {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.text-layer {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.text-layer label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.text-layer-input {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-primary);
}

.text-layer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Color Properties */
.color-properties {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-property {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-property label {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.color-picker-input {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: none;
    padding: 0;
}

.color-picker-input:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* File Upload */
.file-upload-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-message i {
    font-size: 2rem;
    color: var(--text-secondary);
}

.upload-message p {
    margin: 0;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-message small {
    color: var(--text-secondary);
}

/* Uploaded Files */
.uploaded-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.uploaded-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.file-preview {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview i {
    font-size: 18px;
    color: var(--text-secondary);
}

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

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.upload-status {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: var(--transition);
}

.remove-file:hover {
    color: var(--error-color);
    background: rgba(220, 53, 69, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--text-primary);
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}

.close-preview {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-preview:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#preview-canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* Loading States */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-processing {
    background: var(--warning-color);
    color: #000;
}

.status-completed {
    background: var(--success-color);
    color: white;
}

.status-failed {
    background: var(--error-color);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    #template-gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .template-card {
        border-radius: var(--border-radius);
    }
    
    .template-preview {
        height: 150px;
    }
    
    .editor-sidebar {
        padding: 15px;
    }
    
    .customization-sections {
        gap: 20px;
    }
    
    .uploaded-files {
        max-height: 200px;
    }
    
    .autodyna-notification {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .preview-modal-content {
        padding: 20px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .editor-layout {
        padding: 10px;
        gap: 15px;
    }
    
    .editor-preview,
    .editor-sidebar {
        padding: 15px;
    }
    
    .preview-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
        min-width: 100px;
    }
    
    #template-gallery {
        grid-template-columns: 1fr;
        padding: 10px 0;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #404040;
    }
    
    .template-card {
        background: var(--bg-primary);
        border-color: var(--border-color);
    }
    
    .text-layer-input {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-color: var(--border-color);
    }
    
    .upload-dropzone {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .uploaded-file {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .template-card {
        border-width: 3px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .text-layer-input,
    .color-picker-input {
        border-width: 3px;
    }
}

/* Print Styles */
@media print {
    .preview-modal,
    .autodyna-notification,
    .btn,
    .upload-dropzone {
        display: none !important;
    }
}