/* ==================== RESET Y VARIABLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #fdab13;
    --secondary-color: #b1aa45;
    --accent-color: #f5740b;
    --text-color: #ffffff;
    --bg-color: #000000;
    --card-bg: #111111;
    --border-color: #444444;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.7);
    --border-radius: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==================== HEADER ==================== */
.header {
    width: 100%;
    background-color: #000;
    overflow: hidden;
    padding: 1rem 0;
}

.header-image {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
}

.title-image {
    width: 100%;
    max-width: clamp(300px, 60vw, 600px);
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.title-image:hover {
    transform: scale(1.02);
}

/* ==================== TÍTULOS ==================== */
section h2 {
    text-align: center;
    color: var(--text-color);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 2rem;
    padding: 0 1rem;
}

/* ==================== SECCIÓN PRESENTACIÓN ==================== */
.presentation-section {
    padding: 2rem 0;
}

.video-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #000;
}

.video-container::before {
    content: '';
    display: block;
    padding-bottom: 56.25%; /* Aspect ratio 16:9 */
}

#presentationVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
    border-radius: var(--border-radius);
}

/* ==================== SELECTOR DE TIPO VIDEO ==================== */
.video-type-selector {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 4vw, 3rem);
    margin-bottom: 3rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.video-option {
    cursor: pointer;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    border: 2px solid transparent;
    max-width: 200px;
}

.video-option:hover {
    background: rgba(253, 171, 19, 0.1);
    transform: translateY(-5px);
}

.video-option input {
    display: none;
}

.option-image {
    width: clamp(100px, 25vw, 150px);
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: var(--border-radius);
    border: 3px solid var(--border-color);
    transition: all 0.3s ease;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.option-label {
    color: var(--text-color);
    font-weight: 600;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    text-align: center;
    transition: color 0.3s ease;
}

/* Estado seleccionado */
.video-option input:checked + .option-image {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(253, 171, 19, 0.5);
}

.video-option:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(253, 171, 19, 0.15);
}

.video-option:has(input:checked) .option-label {
    color: var(--primary-color);
}

/* ==================== SECCIÓN UPLOAD ==================== */
.upload-section {
    padding: 2rem 0;
}

.video-form {
    max-width: 700px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: clamp(1rem, 4vw, 2rem);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
}

/* ==================== FORMULARIO ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    color: var(--text-color);
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #222;
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==================== SECCIÓN CÁMARA ==================== */
.camera-section {
    margin-top: 2rem;
}

.camera-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.camera-selector label {
    color: var(--text-color);
    font-weight: 5;
}

.camera-selector select,
.camera-selector button {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #222;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.camera-selector button:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.camera-info {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-color);
    font-weight: 500;
}

/* ==================== CONTENEDOR VIDEO PREVIEW ==================== */
.video-preview-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 1rem;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow);
}

.video-preview-container::before {
    content: '';
    display: block;
    padding-bottom: 56.25%; /* Aspect ratio 16:9 */
}

#cameraPreview,
#recordedVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    display: block;
}

#recordedVideo {
    z-index: 2;
}

/* ==================== BOTONES CON ICONOS ==================== */
.btn-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.8rem, 2vw, 1rem);
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 200px;
}

.btn-with-icon:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(253, 171, 19, 0.3);
}

.btn-with-icon:active:not(:disabled) {
    transform: translateY(0);
}

.btn-with-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==================== CONTROLES CÁMARA ==================== */
.camera-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* ==================== TIMER ==================== */
.recording-timer {
    text-align: center;
    margin-top: 1rem;
    color: var(--error-color);
    font-weight: bold;
    font-size: 1.2rem;
    animation: pulse 1s infinite;
}

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

/* ==================== VIDEOS GRID ==================== */
.videos-section {
    padding: 3rem 0;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.videos-grid video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #000;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ==================== MEDIA QUERIES ==================== */

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .video-form {
        margin: 0 15px;
        padding: 1.5rem;
    }

    .camera-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .btn-with-icon {
        max-width: none;
        min-width: auto;
    }

    .camera-selector {
        flex-direction: column;
    }

    .camera-selector select,
    .camera-selector button {
        width: 100%;
    }

    .video-type-selector {
        gap: 1.5rem;
    }

    .video-option {
        min-width: 160px;
    }

    .video-preview-container {
        max-width: 500px;
    }
}

@media (max-width: 480px) {
    .title-image {
        max-width: 90vw;
    }

    section h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .video-type-selector {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .video-option {
        width: 100%;
        max-width: 180px;
        padding: 1.5rem 1rem;
    }

    .option-image {
        width: 120px;
    }

    .video-form {
        margin: 0 10px;
        padding: 1rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.6rem;
        font-size: 16px;
    }

    .btn-with-icon {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
        min-width: 100px;
        max-width: 180px;
    }

    .button-icon {
        width: 20px;
        height: 20px;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .video-preview-container::before {
        padding-bottom: 75%;
    }

    .video-container::before {
        padding-bottom: 60%;
    }
}

@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }

    .video-form {
        padding: 0.75rem;
    }

    .btn-with-icon {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        min-width: 90px;
    }

    .button-icon {
        width: 18px;
        height: 18px;
    }

    .video-option {
        max-width: 150px;
        padding: 1rem 0.5rem;
    }

    .option-image {
        width: 100px;
    }

    .video-preview-container {
        max-width: 280px;
    }
}

@media (min-width: 1200px) {
    .video-container {
        max-width: 1000px;
    }

    .video-preview-container {
        max-width: 650px;
    }

    .video-type-selector {
        gap: 4rem;
    }

    .video-option {
        max-width: 220px;
    }

    .camera-controls {
        gap: 1rem;
    }

    .btn-with-icon {
        max-width: 220px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .video-type-selector {
        flex-direction: row;
        justify-content: center;
    }

    .video-option {
        max-width: 160px;
    }

    .option-image {
        width: 100px;
    }

    .video-preview-container::before {
        padding-bottom: 56.25%;
    }

    .title-image {
        max-height: 120px;
    }
}

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

@media (prefers-contrast: high) {
    :root {
        --border-color: #666666;
        --card-bg: #1a1a1a;
    }
}

@media (hover: none) and (pointer: coarse) {
    .video-option:hover {
        transform: none;
        background: var(--card-bg);
    }

    .video-option:active {
        transform: scale(0.98);
        background: rgba(253, 171, 19, 0.1);
    }

    .btn-with-icon:hover {
        transform: none;
    }

    .btn-with-icon:active:not(:disabled) {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }
}