html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    margin: 0;
    /* --- START: New Background Styles --- */
    
    /* This creates a semi-transparent dark layer over your image */
    background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('/skywarn/podcast/background.jpg');
    
    background-color: #f4f4f9; /* Fallback color if the image fails to load */
    background-size: cover;      /* Ensures the image covers the whole screen */
    background-position: center; /* Centers the image */
    background-attachment: fixed;  /* The image stays fixed in place during scroll */
    background-repeat: no-repeat;  /* Prevents the image from tiling */

    /* --- END: New Background Styles --- */ 
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    max-width: 500px;
    width: 100%;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
}

header .logo {
    max-width: 150px;
    margin-bottom: 15px;
}

header h1 {
    font-size: 1.5em;
    margin: 0 0 5px 0;
}

.updated-notice {
    color: #666;
    font-style: italic;
    margin-top: 0;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

/* Base style for ALL control buttons */
.control-btn {
    background-color: transparent;
    color: #333; /* Dark text for the symbols */
    border: 2px solid #ccc;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 10px;
    transition: all 0.2s ease-in-out;
}

.control-btn:hover {
    border-color: #F9690E; /* SKYWARN Orange on hover */
    color: #F9690E;
}

.progress-container {
    margin-top: 20px;
}

/* --- Styles for the new Clickable Progress Bar --- */

/* This is the gray track of the progress bar */
.progress-bar-container {
    background-color: #e0e0e0;
    height: 10px;
    width: 100%;
    border-radius: 5px;
    cursor: pointer; /* Show a pointer on hover to indicate it's clickable */
    margin-bottom: 5px;
}

/* This is the colored part that shows the progress */
.progress-bar-fill {
    background-color: #007bff; /* The original blue progress color */
    height: 100%;
    width: 0%; /* Start at 0% width */
    border-radius: 5px;
    transition: width 0.1s linear; /* Smooths the progress animation slightly */
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}

.credits {
    margin-top: 20px; /* Adds space above the credits */
    border-top: 1px solid #eee; /* Adds a faint separator line */
    padding-top: 15px;
    font-size: 0.6em;  /* Makes the font smaller */
    color: #666;      /* Sets text to a light gray */
    line-height: 1;
}

.credits p {
    margin: 0; /* Removes extra space between the lines of the credit */
}

.credits a {
    color: #0056b3; /* Makes the link color match your button hover color */
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline; /* Adds an underline on hover for clarity */
}

.stream-link-container {
    margin: 15px 0 20px 0; /* Adds space above and below the button */
    text-align: center;
}

.stream-btn {
    background-color: #c4302b; /* YouTube Red */
    font-weight: bold;
    padding: 8px 16px; /* REDUCED padding from 15px 30px */
    font-size: 0.9em;  /* ADDED to make font slightly smaller */
    width: auto;
    text-decoration: none;
}

.stream-btn:hover {
    background-color: #9B2022; /* A darker red for hover */
}

#install-pwa-btn {
    display: block;
    background-color: #F9690E; /* SKYWARN Orange */
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    margin: 15px auto 0 auto; /* Add space between title and button */
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

#install-pwa-btn:hover {
    background-color: #d45a0c; /* A darker orange for hover */
}

/* Main Play/Pause button - a large, green circle */
#play-pause-btn {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%; /* This makes it a circle */
    font-size: 1.5em;
    padding-left: 5px; /* Nudge the play icon to be visually centered */
}

#play-pause-btn:hover {
    background-color: #218838;
    border-color: #218838;
    color: white;
}

/* Secondary buttons (Restart, Skip) - smaller circles */
.secondary-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2em;
    color: #666;
}

/* Container for the download button */
.download-link-container {
    margin-top: 30px;
    text-align: center;
}

/* Specific styles for the download button */
.download-btn {
    background-color: #6c757d; /* A neutral, functional gray */
    color: white;
    font-weight: bold;
    padding: 8px 16px;
    font-size: 0.9em;
    width: auto;
    text-decoration: none; /* Removes underline from the link */
    border: none; /* Override the base .control-btn border */
    border-radius: 5px; /* Add a radius since we removed the border */
}

.download-btn:hover {
    background-color: #5a6268; /* A darker gray for hover */
    color: white;
    border: none; /* Ensure border doesn't reappear on hover */
}

/* Container for the FEMA app promotion section */
.fema-app-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee; /* Visually separates this section */
}

/* Styling for the informational text */
.fema-text {
    font-size: 0.9em;
    color: #666;
    margin: 0 0 15px 0; /* Space between text and badges */
}

/* Container for the two app store badge links */
.fema-buttons {
    display: flex; /* Use flexbox to place badges side-by-side */
    justify-content: center; /* Center the badges horizontally */
    align-items: center;
    gap: 15px; /* Creates a nice space between the badges */
}

/* Styling for the badge images themselves */
.fema-buttons img {
    height: 30px; /* This controls the size of the badges */
    width: auto;
    transition: opacity 0.2s ease-in-out;
}

.fema-buttons img:hover {
    opacity: 0.8; /* A simple, clean hover effect */
}

.bookmarks-container {
    margin-top: 15px; /* MODIFIED: Reduced from 20px */
    padding-top: 15px;
    border-top: 1px solid #eee; /* Adds a separator line */
    display: flex;
    flex-wrap: wrap; /* Allows buttons to wrap to the next line */
    justify-content: center; /* Center-aligns the buttons */
    gap: 5px; /* MODIFIED: Reduced from 8px for tighter packing */
}

.bookmark-btn {
    background-color: #f0f0f0; /* Light gray background */
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px; /* Small padding */
    font-size: 0.75em; /* Small font size */
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.bookmark-btn:hover {
    background-color: #e0e0e0;
    border-color: #F9690E; /* SKYWARN Orange on hover */
}

/* Style for the duration part of the bookmark */
.bookmark-btn .duration-display {
    color: #555;
    margin-left: 5px;
}

/* Add padding to the body to prevent content from being hidden by the fixed nav bar */
body {
    padding-bottom: 70px; /* Adjust this value to match the height of your .bottom-nav */
}

/* Page content styling */
.page-content {
    width: 100%;
}

#iframe-page {
    width: 100%;
    /* Use a 16:9 aspect ratio for a standard video shape. Adjust if needed. */
    aspect-ratio: 16 / 9; 
    /* Make the iframe container have rounded corners that match the main container */
    border-radius: 8px; 
    /* This is crucial: it clips the sharp corners of the iframe to the rounded shape */
    overflow: hidden; 
    /* Remove the properties that caused the original issues */
    margin: 0; 
    padding: 0;
    height: auto; /* Let aspect-ratio control the height */
}

/* The iframe should perfectly fill its newly shaped container */
#content-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block; /* Fixes potential small gaps that can appear under an iframe */
}


/* Fixed Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 65px; /* Height of the navigation bar */
    background-color: #ffffff;
    display: flex;
    justify-content: space-around;
    align-items: stretch; /* Make buttons fill the height */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Individual Navigation Buttons */
.nav-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    flex-grow: 1; /* Allow buttons to share space equally */
    padding: 5px 0;
    transition: color 0.2s ease-in-out;
}

.nav-btn:hover {
    color: #000;
}

/* Active state for the selected button */
.nav-btn.active {
    color: #F9690E; /* SKYWARN Orange */
}

/* Icon Styling */
.nav-icon {
    font-size: 24px; /* Size of the icon */
    margin-bottom: 2px;
}

/* Text Styling */
.nav-text {
    font-size: 11px;
    font-weight: 500;
}

/* --- START: Dynamic Viewport Sizing for STREAMING PAGE ONLY --- */

/* These rules apply ONLY on large screens AND ONLY when the .container
   has the .streaming-active class added by the JavaScript. */
@media (min-width: 1024px) {
    
    /* 1. Target the container to resize it */
    .container.streaming-active {
        width: 90vw;       /* Use 90% of the viewport width for a more immersive view */
        max-width: 1600px; /* A generous max-width for ultrawide screens */
        height: 85vh;      /* Use 85% of the viewport height */
        
        /* Use flexbox to manage the layout */
        display: flex;
        flex-direction: column;
        
        /* Remove padding to allow the iframe to be edge-to-edge */
        padding: 0;
        transition: all 0.3s ease-in-out; /* Adds a smooth transition effect */
    }
    
    /* 2. Target the iframe page within the active container to make it fill the space */
    .container.streaming-active #iframe-page {
        flex-grow: 1;        /* Expand to fill the available height */
        height: 100%;        /* Fill the vertical space */
        padding: 0;          /* No internal padding */
        overflow: hidden;    /* No scrollbars */
        aspect-ratio: unset; /* Disable the mobile aspect-ratio rule */
        border-radius: 8px;  /* Keep the corners rounded */
    }
}

/* --- END: Dynamic Viewport Sizing for STREAMING PAGE ONLY --- */

/* Wrapper for the external stream controls */
#stream-controls-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px; /* Adds space between the video area and the buttons */
}

/* Style for the Mute and Fullscreen buttons (moved from streaming.php) */
.stream-control-btn {
    background-color: rgba(240, 240, 240, 0.85);
    border: 1px solid #adadad;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
}
.stream-control-btn:hover {
    background-color: rgba(255, 255, 255, 1);
}