* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: white;
    overflow: hidden;
    height: 100vh;
}

.video-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Logo container */
.logo-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.crtvg-logo {
    height: 40px;
    width: auto;
}

/* Camera title container (separado del logo) */
.camera-title-container {
    position: absolute;
    top: 90px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
    max-width: 300px;
}

.camera-title-container h1 {
    margin: 0;
    color: white;
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Camera description EPG style */
.camera-description-epg {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 6px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 1;
    transition: opacity 0.5s ease;
    max-width: 100%;
}

.camera-description-epg p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    line-height: 1.3;
    font-weight: 400;
}

.camera-description-epg.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Camera description external */
.camera-description-external {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 8px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 100;
}

.camera-description-external p {
    margin: 0;
    color: white;
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
}

.camera-description-external.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Camera description above carousel */
.camera-description-above-carousel {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 8px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 150;
}

.camera-description-above-carousel p {
    margin: 0;
    color: white;
    font-size: 0.95rem;
    line-height: 1.4;
    text-align: center;
}

.camera-description-above-carousel.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Auto-play controls */
.auto-play-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.auto-play-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 80px;
}

.timelapse-button {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #2980b9, #1c658c);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.timelapse-button:hover {
    background: linear-gradient(135deg, #1c658c, #13466b);
}

.timelapse-button:disabled {
    background: #5a6870;
    opacity: 0.6;
    cursor: not-allowed;
}

.auto-play-button:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

.auto-play-button.active {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.auto-play-button.active .play-icon {
    content: "";
}

.auto-play-button.active .play-icon::before {
    content: "";
}

.play-icon {
    font-size: 12px;
}

.auto-text {
    font-size: 11px;
    letter-spacing: 1px;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
}

.timer-controls label {
    font-weight: 500;
}

.timer-controls select {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.timer-controls select option {
    background: #333;
    color: white;
}

.camera-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    transition: all 0.3s ease;
}

.camera-dropdown {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 10px 15px;
    font-size: 0.9rem;
    min-width: 200px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.camera-dropdown:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.camera-dropdown:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.camera-dropdown option {
    background: #1a1a1a;
    color: white;
    padding: 8px;
}

.carousel-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.carousel {
    width: 640px;
    overflow: hidden;
    border-radius: 10px;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    gap: 10px;
}

.thumbnail {
    position: relative;
    width: 150px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.thumbnail.active {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

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

.thumbnail-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    text-align: center;
    padding: 5px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 5px;
    font-size: 0.6rem;
    text-align: center;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.carousel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.carousel-btn:active {
    transform: scale(0.95);
}

.carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    font-size: 1.1rem;
    color: #00d4ff;
}

/* Timelapse button */
.timelapse-button {
    background: rgba(0, 212, 255, 0.9);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-left: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.timelapse-button:hover:not(:disabled) {
    background: #00b4d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.timelapse-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.timelapse-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    display: none;
}

/* Timelapse Modal */
.timelapse-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.timelapse-modal.show {
    opacity: 1;
    visibility: visible;
}

.timelapse-modal.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00d4ff;
    animation: spin 1s ease-in-out infinite;
    z-index: 2001;
}

#timelapse-video {
    max-width: 90%;
    max-height: 90%;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.close-timelapse {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    z-index: 2002;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-timelapse:hover {
    opacity: 1;
    background: rgba(255, 0, 0, 0.7);
    transform: rotate(90deg);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Auto-hide functionality */
.auto-hide {
    opacity: 0;
    pointer-events: none;
}

.camera-selector.auto-hide,
.logo-container.auto-hide,
.carousel-container.auto-hide {
    opacity: 0;
    visibility: hidden;
}

/* Responsive design */
@media (max-width: 768px) {
    .logo-container {
        top: 10px;
        left: 10px;
        padding: 8px;
    }
    
    .crtvg-logo {
        height: 30px;
        margin-bottom: 8px;
    }
    
    .camera-title-container {
        top: 60px;
        left: 10px;
        padding: 10px;
    }
    
    .camera-title-container h1 {
        font-size: 1.1rem;
    }
    
    .camera-selector {
        top: 10px;
        right: 10px;
    }
    
    .camera-dropdown {
        min-width: 150px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .carousel {
        width: 500px;
    }
    
    .thumbnail {
        width: 120px;
        height: 80px;
    }
    
    .carousel-container {
        padding: 15px;
        gap: 10px;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        top: 60px;
        left: 10px;
        padding: 6px;
    }
    
    .crtvg-logo {
        height: 25px;
        margin-bottom: 6px;
    }
    
    .camera-title-container {
        top: 90px;
        left: 10px;
        padding: 8px;
    }
    
    .camera-title-container h1 {
        font-size: 0.9rem;
    }
    
    .camera-selector {
        top: 60px;
        right: 10px;
    }
    
    .camera-dropdown {
        min-width: 120px;
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .carousel {
        width: 420px;
    }
    
    .thumbnail {
        width: 100px;
        height: 60px;
    }
    
    .carousel-container {
        bottom: 10px;
        padding: 10px;
    }
    
    .camera-title-container h1 {
        font-size: 1.1rem;
    }
    
    .camera-description-external {
        max-width: 90%;
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .camera-description-above-carousel {
        max-width: 90%;
        padding: 10px 15px;
        font-size: 0.85rem;
        bottom: 160px;
    }
    
    .auto-play-controls {
        flex-direction: column;
        gap: 10px;
        padding: 8px 12px;
    }
    
    .auto-play-button {
        padding: 8px 12px;
        min-width: 70px;
    }
    
    .timer-controls {
        font-size: 12px;
    }
    
    .camera-description-epg {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 320px) {
    .camera-title-container h1 {
        font-size: 0.9rem;
    }
    
    .camera-description-external {
        max-width: 95%;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .camera-description-above-carousel {
        max-width: 95%;
        padding: 8px 12px;
        font-size: 0.8rem;
        bottom: 140px;
    }
    
    .auto-play-controls {
        flex-direction: column;
        gap: 8px;
        padding: 6px 10px;
    }
    
    .auto-play-button {
        padding: 6px 10px;
        min-width: 60px;
        font-size: 11px;
    }
    
    .timer-controls {
        font-size: 11px;
    }
    
    .camera-description-epg {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
}
