/**
 * Dashboard Pages CSS
 * Unified styling for Upload Video and Edit Video pages
 * Black background with gray forms and white inputs
 */

/* ========================================
   Page Container & Background
   ======================================== */
.upload-video-page {
    min-height: calc(100vh - 200px);
    padding: 40px 20px;
    background: #000000;
}

.upload-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ========================================
   Page Header
   ======================================== */
.upload-header {
    text-align: center;
    margin-bottom: 40px;
}

.upload-header h1 {
    font-size: 32px;
    margin: 0 0 10px;
    color: #ffffff;
    font-weight: 700;
}

.upload-header p {
    color: #a0a0a0;
    margin: 0;
    font-size: 16px;
}

/* ========================================
   Form Container (Gray Background)
   ======================================== */
.upload-form {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2a2a;
}

/* ========================================
   Form Sections
   ======================================== */
.form-section {
    margin-bottom: 35px;
    padding-bottom: 35px;
    border-bottom: 1px solid #2a2a2a;
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* ========================================
   Form Layout
   ======================================== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    width: 100%;
}

.form-group.half-width {
    flex: 1;
}

/* ========================================
   Labels (White Text)
   ======================================== */
.upload-form label {
    display: block;
    margin-bottom: 8px;
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
}

/* ========================================
   Inputs, Textareas & Selects (White BG, Black Text)
   ======================================== */
.upload-form input[type="text"],
.upload-form input[type="url"],
.upload-form textarea,
.upload-form select {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #000000;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.upload-form input:focus,
.upload-form textarea:focus,
.upload-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: #ffffff;
}

.upload-form input::placeholder,
.upload-form textarea::placeholder {
    color: #666666;
}

/* Textarea Specific */
.upload-form textarea {
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.5;
}

/* Select Specific */
.upload-form select {
    padding: 8px 12px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.upload-form select option {
    padding: 8px;
    background: #ffffff;
    color: #000000;
}

.upload-form select option:checked {
    background: #667eea;
    color: #ffffff;
}

/* ========================================
   Helper Text & Small Elements
   ======================================== */
.upload-form small {
    color: #a0a0a0;
    font-size: 13px;
    display: block;
    margin-top: 5px;
}

#duration-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 5px;
}

/* ========================================
   Preview Sections
   ======================================== */
#thumbnail-preview,
#trailer-preview {
    margin-top: 15px;
    padding: 15px;
    background: #0a0a0a;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
}

#thumbnail-preview img {
    max-width: 300px;
    height: auto;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    display: block;
}

#trailer-preview video {
    max-width: 400px;
    height: auto;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    display: block;
}

/* ========================================
   Form Actions (Buttons)
   ======================================== */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #2a2a2a;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: #ffffff;
    flex: 1;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #4a4a4a;
    color: #888888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #2a2a2a;
    color: #ffffff;
    border: 2px solid #3a3a3a;
}

.btn-secondary:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
}

.btn .btn-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% { 
        stroke-dasharray: 1, 150; 
        stroke-dashoffset: 0; 
    }
    50% { 
        stroke-dasharray: 90, 150; 
        stroke-dashoffset: -35; 
    }
    100% { 
        stroke-dasharray: 90, 150; 
        stroke-dashoffset: -124; 
    }
}

/* ========================================
   Messages (Success/Error)
   ======================================== */
.form-message {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 14px;
    font-weight: 500;
}

.form-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ff6b6b;
}

.form-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    color: #34d399;
}

/* Legacy message classes */
p.error,
.error-state p.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ff6b6b;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
}

p.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    color: #34d399;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.error-state {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    border: 1px solid #2a2a2a;
}

.error-state .btn-primary {
    margin-top: 20px;
    display: inline-flex;
}

/* ========================================
   SVG Icons
   ======================================== */
.btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .upload-video-page {
        padding: 20px 15px;
    }

    .upload-form {
        padding: 25px 20px;
    }

    .upload-header h1 {
        font-size: 26px;
    }

    .upload-header p {
        font-size: 14px;
    }

    .section-title {
        font-size: 18px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group.half-width {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    #thumbnail-preview img {
        max-width: 100%;
    }

    #trailer-preview video {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .upload-form {
        padding: 20px 15px;
    }

    .upload-header h1 {
        font-size: 24px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    /* Center and contain preview media */
    #thumbnail-preview,
    #trailer-preview {
        text-align: center;
        overflow: hidden;
    }

    #thumbnail-preview img,
    #trailer-preview video {
        max-width: 100%;
        width: 100%;
        height: auto;
    }
}

/* ========================================
   Accessibility
   ======================================== */
.upload-form input:focus-visible,
.upload-form textarea:focus-visible,
.upload-form select:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .upload-video-page {
        background: #ffffff;
    }

    .upload-form {
        background: #ffffff;
        border: 1px solid #000000;
    }

    .form-actions {
        display: none;
    }
}