/* AI Video Editor Frontend Styles */

.aive-frontend-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.aive-video-editor {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.aive-credits-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
}

.aive-credits-number {
    font-size: 2.5em;
    font-weight: bold;
    display: block;
}

.aive-credits-label {
    font-size: 1.1em;
    opacity: 0.9;
    margin-top: 5px;
}

.aive-upload-section {
    margin-bottom: 30px;
}

.aive-upload-area {
    border: 3px dashed #ddd;
    border-radius: 8px;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.aive-upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.aive-upload-area.dragover {
    border-color: #667eea;
    background: #e8f2ff;
    transform: scale(1.02);
}

.aive-upload-icon {
    font-size: 3em;
    color: #ddd;
    margin-bottom: 15px;
}

.aive-upload-text {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 10px;
}

.aive-upload-subtext {
    font-size: 0.9em;
    color: #999;
}

.aive-form-section {
    margin-bottom: 25px;
}

.aive-form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.aive-form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.aive-form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.aive-form-textarea {
    height: 120px;
    resize: vertical;
    font-family: inherit;
}

.aive-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.aive-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.aive-submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.aive-progress {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.aive-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.aive-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.aive-video-preview {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.aive-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.aive-video-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.aive-video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.aive-video-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.aive-video-info {
    padding: 15px;
}

.aive-video-prompt {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aive-video-meta {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.aive-video-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.aive-status-pending {
    background: #fff3cd;
    color: #856404;
}

.aive-status-processing {
    background: #d1ecf1;
    color: #0c5460;
}

.aive-status-completed {
    background: #d4edda;
    color: #155724;
}

.aive-status-failed {
    background: #f8d7da;
    color: #721c24;
}

.aive-download-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.aive-download-button:hover {
    background: #218838;
    color: white;
}

.aive-credits-history {
    margin-top: 30px;
}

.aive-history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aive-history-table th,
.aive-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.aive-history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.aive-credits-positive {
    color: #28a745;
    font-weight: 600;
}

.aive-credits-negative {
    color: #dc3545;
    font-weight: 600;
}

.aive-alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.aive-alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.aive-alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.aive-alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.aive-alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.aive-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
    .aive-frontend-wrap {
        padding: 20px 15px;
    }
    
    .aive-videos-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .aive-frontend-wrap {
        padding: 15px 10px;
    }
    
    .aive-video-editor {
        padding: 20px 15px;
    }
    
    .aive-videos-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .aive-upload-area {
        padding: 25px 15px;
    }
    
    .aive-upload-icon {
        font-size: 2.5em;
    }
    
    .aive-upload-text {
        font-size: 1.1em;
    }
    
    .aive-credits-number {
        font-size: 2em;
    }
    
    .aive-form-input,
    .aive-form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .aive-submit-button {
        padding: 18px 25px;
        font-size: 16px;
    }
    
    /* Stack credit info cards vertically on mobile */
    .aive-credits-info-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .aive-frontend-wrap {
        padding: 10px 5px;
    }
    
    .aive-video-editor {
        padding: 15px 10px;
    }
    
    .aive-upload-area {
        padding: 20px 10px;
    }
    
    .aive-upload-icon {
        font-size: 2em;
    }
    
    .aive-upload-text {
        font-size: 1em;
    }
    
    .aive-upload-subtext {
        font-size: 0.8em;
    }
    
    .aive-credits-number {
        font-size: 1.8em;
    }
    
    .aive-form-label {
        font-size: 14px;
    }
    
    .aive-form-input,
    .aive-form-textarea {
        padding: 15px 12px;
    }
    
    .aive-submit-button {
        padding: 20px 15px;
        font-size: 15px;
    }
    
    .aive-history-table {
        font-size: 0.85em;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .aive-history-table th,
    .aive-history-table td {
        padding: 6px 8px;
        min-width: 80px;
    }
    
    .aive-video-info {
        padding: 12px;
    }
    
    .aive-video-prompt {
        font-size: 14px;
        -webkit-line-clamp: 3;
    }
    
    .aive-video-meta {
        font-size: 12px;
    }
    
    .aive-download-button {
        padding: 6px 12px;
        font-size: 12px;
        display: block;
        text-align: center;
        margin-bottom: 5px;
    }
}

/* Touch-friendly enhancements */
@media (max-width: 768px) and (pointer: coarse) {
    .aive-upload-area {
        min-height: 120px;
        cursor: pointer;
    }
    
    .aive-form-input,
    .aive-form-textarea,
    .aive-submit-button {
        min-height: 44px; /* iOS touch target minimum */
    }
    
    .aive-copy-button {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .aive-video-editor {
        background: #1a1a1a;
        color: #ffffff;
        border-color: #333;
    }
    
    .aive-form-input,
    .aive-form-textarea {
        background: #2a2a2a;
        color: #ffffff;
        border-color: #444;
    }
    
    .aive-form-input:focus,
    .aive-form-textarea:focus {
        border-color: #667eea;
        background: #333;
    }
    
    .aive-upload-area {
        background: #2a2a2a;
        border-color: #444;
        color: #ccc;
    }
    
    .aive-upload-area:hover {
        background: #333;
        border-color: #667eea;
    }
    
    .aive-video-card {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .aive-history-table {
        background: #2a2a2a;
    }
    
    .aive-history-table th {
        background: #333;
        color: #fff;
    }
}

/* Mobile touch enhancements */
.aive-touch-device .aive-upload-area.aive-touch-active {
    transform: scale(0.98);
    opacity: 0.9;
}

.aive-touch-device .aive-submit-button:active {
    transform: scale(0.98);
}

.aive-touch-device .aive-download-button:active {
    transform: scale(0.95);
}

/* Loading states for better UX */
.aive-form-input:disabled,
.aive-form-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aive-processing .aive-upload-area {
    pointer-events: none;
    opacity: 0.5;
}

/* Smooth scrolling for all devices */
html {
    scroll-behavior: smooth;
}

/* Accessibility improvements */
.aive-form-input:focus,
.aive-form-textarea:focus,
.aive-submit-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .aive-upload-area {
        border-width: 3px;
        border-style: solid;
    }
    
    .aive-submit-button {
        border: 2px solid #333;
    }
    
    .aive-video-status {
        border: 1px solid currentColor;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .aive-progress-fill {
        animation: none;
    }
}

/* Print styles */
@media print {
    .aive-upload-area,
    .aive-submit-button,
    .aive-download-button {
        display: none;
    }
    
    .aive-video-editor {
        box-shadow: none;
        border: 1px solid #333;
    }
    
    .aive-credits-display {
        background: #f0f0f0 !important;
        color: #333 !important;
    }
}

/* Video Cutter Styles */
.aive-cutter-section {
    background: #f8f9fc;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.aive-cutter-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4em;
}

.aive-cutter-description {
    color: #666;
    margin-bottom: 20px;
    background: #fff3cd;
    padding: 10px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
}

.aive-video-cutter {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aive-cutter-video {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aive-cutter-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.aive-timeline-container {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.aive-timeline-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.aive-timeline {
    position: relative;
    height: 40px;
    margin: 20px 0;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
}

.aive-timeline-track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: #e9ecef;
}

.aive-selection-range {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 20px;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.aive-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    z-index: 10;
}

.aive-handle:hover {
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.aive-handle-start {
    left: -10px;
}

.aive-handle-end {
    right: -10px;
}

.aive-time-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.aive-time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aive-time-input-group label {
    font-weight: 500;
    color: #333;
    min-width: 80px;
}

.aive-time-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.aive-time-input-group span {
    color: #666;
    font-size: 14px;
}

.aive-cutter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.aive-button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aive-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.aive-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.aive-button-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.aive-button-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.aive-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.aive-cutter-progress {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
    text-align: center;
}

.aive-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.aive-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#cutting-status {
    color: #666;
    font-size: 14px;
}

/* Responsive adjustments for video cutter */
@media (max-width: 768px) {
    .aive-video-cutter {
        gap: 15px;
    }
    
    .aive-time-inputs {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .aive-cutter-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .aive-button {
        width: 100%;
        justify-content: center;
    }
}