/* Reset default styles for the widget's scope */
.radio-status-container div,
.radio-status-container p,
.radio-status-container h1,
.radio-status-container a,
.radio-status-container img,
.radio-status-container audio {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.radio-status-container {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 0.625em;
    box-shadow: 0 0 1.25em rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 0.0625em solid #444;
    display: flex;
    flex-direction: column;
}

.radio-status-container .content-wrapper {
    display: flex;
}

.radio-status-container .left-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    flex-shrink: 0;
}

.radio-status-container .show-image {
    position: relative;
    width: var(--dj-image-size, 9.375em);
    height: var(--dj-image-size, 9.375em);
    max-width: 100%;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radio-status-container .show-image::before {
    content: "";
    position: absolute;
    top: -1em;
    left: -1em;
    right: -1em;
    bottom: -1em;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(0.625em) brightness(0.7);
    z-index: 1;
}

.radio-status-container .show-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

#no-cover-message,
#no-dj-message {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background-color: #333;
    font-size: 3em; /* Larger icon */
    font-weight: bold;
    color: #888;
    position: relative;
    z-index: 2;
}

#album-cover-container {
    width: var(--album-art-size, 9.375em);
    height: var(--album-art-size, 9.375em);
    max-width: 100%;
    margin-top: 0.625em;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

#album-cover-container::before {
    content: "";
    position: absolute;
    top: -1em;
    left: -1em;
    right: -1em;
    bottom: -1em;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(0.625em) brightness(0.7);
    z-index: 1;
}

#album-cover-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.radio-status-container .on-air-indicator {
    position: absolute;
    top: 0.625em;
    left: 0.625em;
    z-index: 3;
    background-color: #ff0000;
    color: #fff;
    padding: 0.3125em 0.625em;
    border-radius: 0.3125em;
    font-size: 0.875em;
    font-weight: bold;
}

/* --- Layouts --- */
/* Compact Layout */
.layout-compact .left-panel {
    display: none; /* Hide the entire left panel */
}
.layout-compact .show-info {
    padding: 1em; /* Reduce padding */
}
.layout-compact .show-name {
    font-size: 1.25em; /* Smaller show name */
}

/* Horizontal Layout */
.layout-horizontal .content-wrapper {
    flex-direction: row;
    align-items: stretch; /* Make panels equal height */
}
.layout-horizontal .left-panel {
    width: auto; /* Let it shrink to fit content */
    flex-direction: row; /* Align images side-by-side */
    justify-content: flex-start;
    align-items: center;
    padding: 0.625em;
}
/* --- Player Style Specific Rules --- */

/* Hide stop button by default */
#stop-button {
    display: none;
}

/* --- Multi-Button Style --- */
.player-style-multi-button #stop-button {
    display: flex; /* Show the stop button */
    background-color: #d9534f; /* Red */
}
.player-style-multi-button #stop-button:hover {
    background-color: #c9302c;
}

.player-style-multi-button #play-pause-button {
    background-color: #5cb85c; /* Green for play */
}
.player-style-multi-button #play-pause-button:hover {
    background-color: #4cae4c;
}
.player-style-multi-button #play-pause-button.is-playing {
    background-color: #f0ad4e; /* Orange for pause */
}
.player-style-multi-button #play-pause-button.is-playing:hover {
    background-color: #ec971f;
}


/* --- Round Player Style --- */
.player-style-round .audio-player-container {
    position: relative;
    width: 9.375em; /* Same as album art */
    height: 9.375em;
    margin: 1.25em auto;
}

.player-style-round .player-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.player-style-round .audio-player-container:hover .player-controls {
    opacity: 1;
}

.player-style-round #play-pause-button {
    width: 3.75em;
    height: 3.75em;
    font-size: 1.5em;
}

.player-style-round .volume-container {
    position: absolute;
    bottom: -1.875em; /* Position it below the circle */
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
}

.player-style-round .show-image {
    display: none; /* Hide the default DJ image for the round player */
}
.player-style-round .left-panel #album-cover-container {
    border-radius: 50%;
    overflow: hidden;
    width: 9.375em; /* Ensure container has a size */
    height: 9.375em;
}
.player-style-round .left-panel #album-cover-image {
    border-radius: 50%;
}
.layout-horizontal .show-image,
.layout-horizontal #album-cover-container {
    width: 6.25em; /* Fixed size for predictability */
    height: 6.25em;
    margin-top: 0; /* Override default margin */
    margin-right: 0.625em; /* Space between images */
}
.layout-horizontal .show-info {
    padding: 0.625em;
    text-align: left;
    justify-content: center;
    flex-grow: 1; /* Allow info to take remaining space */
}
.layout-horizontal .show-name {
    font-size: 1.125em; /* Smaller font for show name */
}
.layout-horizontal .song-title {
    font-size: 1em; /* Smaller font for song title */
}

.radio-status-container .show-info {
    padding: 1.25em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1; /* Allow this panel to take up remaining space */
    min-width: 0; /* Prevents overflow with long text */
}

.radio-status-container .show-name-marquee {
    width: 100%;
}

.radio-status-container .show-name {
    display: block;
    margin-top: 0;
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 0.3125em;
    word-wrap: break-word;
}

.radio-status-container .live-show-details {
    margin-top: 0.625em;
}

.radio-status-container .show-time-label,
.radio-status-container .show-motto-label {
    font-size: 1em;
    font-weight: bold;
    color: #ffc107;
    margin-top: 0.3125em;
}

.radio-status-container .show-time {
    font-size: 0.875em;
    color: #ccc;
    margin: 0.125em 0 0.625em 0;
}

.radio-status-container .show-motto {
    font-size: 0.875em;
    color: #ccc;
    margin: 0.125em 0;
    font-style: italic;
}

.radio-status-container .song-title-label {
    font-size: 1em;
    font-weight: bold;
    color: #ffc107;
    margin-top: 0.9375em;
    margin-bottom: 0.3125em;
}

.radio-status-container .song-title-marquee {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.radio-status-container .song-title {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 15s linear infinite;
    font-size: 1.125em;
}

.radio-status-container .dj-name {
    font-size: 1em;
    margin-top: 0.9375em;
}

.listener-count-container {
    font-size: 0.875em;
    margin-top: 0.625em;
    text-align: right;
    font-weight: bold;
}

.radio-status-container .audio-player-container {
    margin-top: 1.25em; /* Increased margin for better spacing */
}

/* Hide the default audio player */
.radio-status-container #audio-player {
    display: none;
}

.radio-status-container .player-controls {
    display: flex;
    align-items: center;
    gap: 0.625em;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 0.625em;
    border-radius: 0.3125em;
}

.radio-status-container .control-button {
    background: none;
    border: 0.125em solid #fff;
    color: #fff;
    width: 2.5em;
    height: 2.5em;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.125em;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

.radio-status-container .control-button:hover {
    background-color: #fff;
    color: #333;
}

.radio-status-container .volume-container {
    display: flex;
    align-items: center;
    flex-grow: 1;
    gap: 0.625em;
}

.radio-status-container .volume-container i {
    font-size: 1.125em;
}

.radio-status-container #volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.5em;
    background: #555;
    border-radius: 0.3125em;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}

.radio-status-container #volume-slider:hover {
    opacity: 1;
}

.radio-status-container #volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.125em;
    height: 1.125em;
    background: #ffc107;
    cursor: pointer;
    border-radius: 50%;
}

.radio-status-container #volume-slider::-moz-range-thumb {
    width: 1.125em;
    height: 1.125em;
    background: #ffc107;
    cursor: pointer;
    border-radius: 50%;
}

/* Custom Audio Player Styles */
.radio-status-container audio::-webkit-media-controls-panel {
    background-color: #333;
}
.radio-status-container audio::-webkit-media-controls-play-button,
.radio-status-container audio::-webkit-media-controls-mute-button {
    background-color: #ffc107;
    border-radius: 50%;
}
.radio-status-container audio::-webkit-media-controls-timeline {
    background-color: #555;
    border-radius: 0.125em;
}
.radio-status-container audio::-webkit-media-controls-current-time-display,
.radio-status-container audio::-webkit-media-controls-time-remaining-display {
    color: #fff;
}

/* Marquee Animation */
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Button Styles */
.radio-status-container .buttons-container {
    display: flex;
    justify-content: space-between;
    gap: 0.625em; /* Add space between buttons */
    margin-top: 0.9375em;
}

.radio-status-container .button {
    flex-grow: 1; /* Make buttons share the space equally */
    padding: 0.625em; /* Increase padding for better touch targets */
    border-radius: 0.3125em;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.875em;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.radio-status-container .button:hover {
    opacity: 0.9;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* 10% from the top and centered */
    padding: 1.25em;
    border: 0.0625em solid #888;
    width: 80%;
    max-width: 37.5em;
    height: 70%;
    border-radius: 0.625em;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-content iframe {
    width: 100%;
    height: 100%; /* Fill the container */
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 0.625em;
    right: 1.25em;
    font-size: 1.75em;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Player Modal Specific Styles */
#player-modal .modal-content {
    height: auto; /* Auto height based on content */
    max-width: 31.25em;
    text-align: center;
}

.player-links-container {
    display: flex;
    justify-content: center;
    gap: 1.25em;
    margin-top: 1.25em;
    flex-wrap: wrap;
}

.player-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-link-label {
    margin-bottom: 0.5em;
    font-weight: bold;
    font-size: 0.875em;
}

.player-link-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.9375em;
    background-color: #808080; /* Gray background */
    color: #fff;
    text-decoration: none;
    border-radius: 0.5em;
    transition: background-color 0.3s;
    width: 5em; /* Fixed width */
    height: 5em; /* Fixed height */
}

.player-link-button:hover {
    background-color: #555;
}

.player-link-button i,
.player-link-button img {
    font-size: 1.5em;
    margin-bottom: 0.5em;
    height: 1.5em; /* Ensure images and icons are the same height */
}

.player-link-button span {
    font-size: 0.875em;
    font-weight: bold;
}

/* --- Image Position Logic --- */
/* For right-aligned images, reverse the order of the panels */
.image-position-right .content-wrapper {
    flex-direction: row-reverse;
}

.image-position-right .left-panel {
    margin-right: 0;
    margin-left: 1.25em;
}

/* For center-aligned images, keep content stacked but images side-by-side */
.image-position-center .content-wrapper {
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.image-position-center .left-panel {
    flex-direction: row; /* Align DJ and Album art side-by-side */
    flex-wrap: wrap; /* Stacks if width is insufficient */
    justify-content: center;
    align-items: center;
    margin-bottom: 1.25em;
    margin-right: 0; /* Remove default right margin */
    width: 100%; /* Take full width to center content */
    gap: 0.625em;
    padding: 0; /* Ensure no padding shifts images */
}

.image-position-center #album-cover-container {
    margin-top: 0;
}

.image-position-center .show-info {
    text-align: center;
    align-items: center; /* Center children in flex column */
    width: 100%;
}

.image-position-center .buttons-container {
    justify-content: center; /* Center the buttons */
    flex-wrap: wrap;
}

.image-position-center .buttons-container .button {
    flex-grow: 0; /* Don't force buttons to fill width in centered layout */
    min-width: 8em;
}

/* For bottom-aligned images, text above images */
.image-position-bottom .content-wrapper {
    flex-direction: column-reverse;
    align-items: center;
    width: 100%;
}

.image-position-bottom .left-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-top: 1.25em;
    margin-right: 0;
    width: 100%;
    gap: 0.625em;
    padding: 0;
}

.image-position-bottom #album-cover-container {
    margin-top: 0;
}

.image-position-bottom .show-info {
    text-align: center;
    align-items: center;
    width: 100%;
}

.image-position-bottom .buttons-container {
    justify-content: center;
    flex-wrap: wrap;
}

.image-position-bottom .buttons-container .button {
    flex-grow: 0;
    min-width: 8em;
}

/* Auto Image Sizing */
.image-size-auto .left-panel {
    flex: 0 1 12.5em; /* Basis of 12.5em but can shrink */
    width: 100%;
    min-width: 5em;
}

.image-size-auto .show-image,
.image-size-auto #album-cover-container {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
}

.image-size-auto.image-position-center .left-panel,
.image-size-auto.image-position-bottom .left-panel {
    flex: 0 1 auto; /* Allow them to take needed space in horizontal layouts */
    max-width: 100%;
}

.image-size-auto.image-position-center .show-image,
.image-size-auto.image-position-center #album-cover-container,
.image-size-auto.image-position-bottom .show-image,
.image-size-auto.image-position-bottom #album-cover-container {
    width: 8em !important; /* Smaller default for horizontal layouts */
    max-width: 45%;
}
