/* General Body and Font Styling */
body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #e6f2ff 0%, #b3d9ff 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Main container for the entire application */
.main-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
    position: relative;
}

/* Left section containing video player and controls */
.video-section {
    flex: 1;
    background: rgba(173, 216, 230, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    margin-right: 300px; /* Space for info cards on desktop */
}

/* Top controls for URL input and video upload */
.top-controls {
    display: flex;
    gap: 10px;
    background: rgba(23, 39, 114, 0.8);
    padding: 15px;
    border-radius: 15px;
}

#videoUrl {
    flex: 1;
    min-width: 150px; /* Prevents input from becoming too small */
    height: 40px;
    padding: 0 15px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
}

/* General button styling */
.control-button {
    height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s;
    white-space: nowrap; /* Prevents text wrapping on buttons */
}

.primary-button {
    background: black;
    color: white;
}

.secondary-button {
    background: yellow;
    color: black;
    min-width: 40px; /* Ensures refresh button doesn't shrink */
}

.primary-button:hover {
    background: #0066cc;
}

.secondary-button:hover {
    background: #ffd700;
}

/* Container for the video player itself */
.video-container {
    background: rgba(23, 39, 114, 0.8);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

#videoContainer {
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16/9;
    background: black;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#videoContainer iframe,
#videoContainer video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

#controls {
    width: 100%;
    color: white;
}

#timeRangesContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.timeRangeRow {
    display: flex;
    gap: 10px;
    align-items: center;
}

.timeRangeRow input {
    flex: 1;
    height: 40px;
    padding: 0 15px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    min-width: 80px; /* Ensures inputs are usable on small screens */
}

.action-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: transform .2s;
    flex-shrink: 0; /* Prevents buttons from shrinking */
}

.action-button:hover {
    transform: scale(1.1);
}

#currentTimeDisplay {
    color: white;
    text-align: center;
    margin: 10px 0;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all .2s;
}

#currentTimeDisplay:hover {
    background: rgba(0, 127, 255, 0.7);
    transform: scale(1.03);
}

/* Right-side info cards for desktop */
.info-cards {
    position: absolute;
    right: 0;
    width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.info-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow: hidden;
}

.info-card-top {
    height: 300px;
    position: relative;
}

.info-card-bottom {
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Slideshow styling */
.slideshow {
    height: 100%;
    position: relative;
}

.slide {
    display: none;
    height: 100%;
    animation: fadeEffect 1s;
}

.slide.active {
    display: block;
}

@keyframes fadeEffect {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.slide h3 {
    color: #0066CC;
    margin-top: 0;
    margin-bottom: 10px;
    font-style: italic;
    font-weight: bold;
}

.slide p {
    margin: 0;
    line-height: 1.5;
    font-style: italic;
    font-weight: bold;
}

.slide-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    z-index: 10;
}

.slide-nav:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.slide-nav.prev { left: 10px; }
.slide-nav.next { right: 10px; }

.info-card-top:hover .slide-nav {
    opacity: 1;
}

/* Card flip effect styling */
.card-flip-container {
    width: 100%;
    height: 75%;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back {
    transform: rotateY(180deg);
    padding: 10px;
    text-align: center;
}

.card-back p {
    font-style: italic;
    font-size: 14px;
    color: #333;
}

.info-card-bottom:hover .card-flip-container {
    transform: rotateY(180deg);
}

.download-container {
    width: 100%;
    height: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: black;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.download-link:hover {
    background-color: #333;
    color: #00BFFF;
}

.logo-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- RESPONSIVE DESIGN STYLES --- */

/* For tablets and smaller desktops */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .video-section {
        margin-right: 0;
    }
    
    .info-cards {
        position: relative;
        width: 100%;
        height: auto;
        margin-top: 20px;
        flex-direction: row; /* Side-by-side on tablets */
        flex-wrap: wrap;
    }

    .info-card {
        flex: 1;
        min-width: 280px; /* Prevent cards from getting too small */
    }
    
    .info-card-top, .info-card-bottom {
        height: auto;
        min-height: 200px;
    }
}

/* For mobile phones */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .video-section, .video-container {
        padding: 10px;
    }

    .top-controls {
        flex-direction: column;
        align-items: stretch; /* Make buttons full width */
    }

    .control-button {
        height: 45px; /* Slightly larger for touch targets */
    }

    .timeRangeRow {
        flex-direction: column;
        align-items: stretch;
    }

    .timeRangeRow input {
        width: 100%;
        box-sizing: border-box;
    }

    .action-button {
        align-self: flex-end; /* Move add/remove button to the side */
        margin-top: -35px; /* Position it nicely */
        margin-right: 5px;
        color: #333;
        background: rgba(255, 255, 255, 0.7);
    }

    #controls .primary-button {
        flex-grow: 1; /* Allow clip/trim/reset buttons to share space */
    }

    .info-cards {
        flex-direction: column; /* Stack cards vertically on phones */
    }
}