/* --- Global Resets & CSS Variables --- */
:root {
    --bg-color: #1a1a1a;
    --card-bg: #262626;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --accent-color: #ff3333;
    --accent-hover: #cc0000;
    --border-color: #333333;
    --shadow: rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
    --bg-color: #f4f4f4;
    --card-bg: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --accent-color: #d62222;
    --accent-hover: #b31c1c;
    --border-color: #dddddd;
    --shadow: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: var(--transition);
    overflow: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* --- Header Styling --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background-color: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo i { color: var(--accent-color); margin-right: 5px; }
.logo span { color: var(--accent-color); }

.nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

#notifyButton {
    background-color: var(--accent-color);
}

.nav-controls button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.nav-controls button:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* --- Master Split Layout Workspace --- */
.app-workspace {
    flex: 1;
    display: flex;
    width: 100%;
    overflow: hidden;
}

/* --- Media Player Layout Panel (Left Side Space) --- */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Center horizontally */
    padding: 2rem;
    position: relative; /* Crucial anchor for the floating status badge */
    overflow-y: auto;
}

#status-container {
    position: absolute;
    top: 2.5rem; /* Floating padding from the top header */
    left: 50%;
    transform: translateX(-50%); /* Keeps it perfectly centered horizontally */
    margin-bottom: 0;
    z-index: 5;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.4rem 1.2rem;
    margin-top: 30%;
    border-radius: 20px;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
}

#status-container>div>i {
    font-size: 1.5rem;
    margin-top: 2%;
}

.status-badge.checking { background-color: rgba(160, 160, 160, 0.15); color: var(--text-muted); border: 1px solid var(--text-muted); }
.status-badge.offline { background-color: rgba(255, 51, 51, 0.15); color: var(--accent-color); border: 1px solid var(--accent-color); }
.status-badge.online { background-color: rgba(46, 204, 113, 0.15); color: #2ecc71; border: 1px solid #2ecc71; }
.status-badge.online i { animation: pulse 1.5s infinite; }

/* Interactive Album Cover & Play/Pause presentation Rules */
.album-art {
    width: 220px;
    height: 220px;
    background: linear-gradient(145deg, #1e1e1e, #2a2a2a);
    border: 5px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 35px var(--shadow);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition), transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.light-theme .album-art { background: linear-gradient(145deg, #e6e6e6, #ffffff); }

/* Bouncy Animation on Hover */
.album-art:hover {
    transform: scale(1.06);
    box-shadow: 0 16px 40px rgba(255, 51, 51, 0.25);
    border-color: white;
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease-in-out, filter 0.3s ease;
}

/* Status Overlays inside the Album Art Container */
.album-art-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.4);
    transition: var(--transition);
    pointer-events: none;
    z-index: 2;
}

.album-art-overlay i {
    font-size: 4rem;
    color: #ffffff;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
    transition: var(--transition);
}

/* Playing States */
.album-art.is-playing .album-art-overlay {
    background-color: rgba(0, 0, 0, 0.2);
}
.album-art.is-playing .album-art-overlay i {
    opacity: 0.35;
}
.album-art.is-playing:hover .album-art-overlay {
    background-color: rgba(0, 0, 0, 0.4);
}
.album-art.is-playing:hover .album-art-overlay i {
    opacity: 0.9;
}

/* Paused States */
.album-art.is-paused .album-art-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}
.album-art.is-paused img,
.album-art.is-paused #album-art-fallback {
    filter: blur(1px) grayscale(20%);
}
.album-art.is-paused .album-art-overlay i {
    opacity: 0.35;
}

.album-art.is-paused:hover .album-art-overlay i {
    opacity: 0.9;
}

.track-info {
    flex: 1;
    text-align: left;
}


.track-info h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.track-info h2 {
    font-size: 1.6rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 1rem;
}

#currently-playing-label {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-color); /* Gives it your signature red accent color */
    margin-bottom: 0.2rem;
    opacity: 0.9;
}

.listener-stats { font-size: 1.05rem; color: var(--text-muted); font-weight: bold; }

.listener-stats>i {
    margin-right: 0.2rem;
}

/* Control Layout Configurations & Vertical Volume Slider */
.audio-controls {
    width: auto;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    width: 90%;
    justify-content: center;
}

.volume-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 1.1rem;
    height: 220px; /* Matches the album-art size height */
    justify-content: center;
}

.volume-container input[type="range"] {
    writing-mode: vertical-lr;
    direction: rtl;
    appearance: slider-vertical;
    width: 6px;
    height: 140px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

/* Fixes the sizing issue causing layouts to twitch during icon alterations */
#volume-icon {
    width: 24px;
    text-align: center;
    display: inline-block;
    cursor: pointer;
    transition: var(--transition);
}

#volume-icon:hover {
    color: var(--accent-color);
    transform: scale(1.15);
}

.offline-embed {
    width: 100%;
    max-width: 650px;
}

.offline-embed p { margin-bottom: 12px; color: var(--text-muted); font-size: 1rem; }
.offline-embed iframe { border-radius: 8px; box-shadow: 0 4px 15px var(--shadow); }

/* --- Persistent Layout Chat (Right Side Panel) --- */
.chat-sidebar {
    width: 400px;
    background-color: var(--card-bg);
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-header h3 { font-weight: 600; font-size: 1.2rem; }

.chat-status {
    text-align: center;
    font-size: 0.85rem;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.95rem;
}

.message { margin-bottom: 1rem; line-height: 1.5; }

.chat-input-area-wrapper {
    padding: 1.2rem 0;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.chat-username-error {
    color: var(--accent-color);
    font-size: 0.85rem;
    display: none;
    padding-left: 1.5rem;
    margin-bottom: 6px;
    font-weight: 600;
}

#chatUsername {
    width: calc(100% - 3rem);
    margin: 0 auto 10px auto;
    display: block;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 4px;
    outline: none;
}

.chat-input-area { display: flex; gap: 10px; padding: 0 1.5rem; }
.chat-input-area input {
    flex: 1;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.7rem 1rem;
    border-radius: 4px;
    outline: none;
}

.chat-input-area button {
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0 1.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}
.chat-input-area button:hover { background-color: var(--accent-hover); }

.mobile-only-btn {
    display: none !important;
    background: none !important;          /* Forces background to be transparent */
    border: 1px solid var(--border-color) !important; /* Matches header button borders */
    color: var(--text-main) !important;    /* Forces correct light/dark text colors */
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

/* Ensure the hover effect matches your existing theme design */
.mobile-only-btn:hover {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #fff !important;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* --- Responsive Layout Breakpoints --- */
@media(max-width: 992px) {
    .mobile-only-btn {
        display: inline-block !important;
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        right: -400px;
        z-index: 100;
        box-shadow: -5px 0 25px var(--shadow);
        transition: var(--transition);
    }

    .chat-sidebar.open {
        right: 0;
    }

    .main-container {
        padding: 2rem 2rem 2rem 10%;
    }

    .controls-row {
        flex-direction: row;
        justify-content: center;
        max-width: 100%;
        gap: 1.5rem;
    }

    .track-info {
        text-align: left;
    }

    .track-info h1 {
        font-size: 2.2rem;
    }

    .volume-container {
        height: 160px;
    }

    .volume-container input[type="range"] {
        height: 100px;
    }
}

@media(max-width: 768px) {
    #live-circle {
        font-size: 1.3rem;
        margin-top: 0;
    }

    .status-badge {
        font-size: 1.6rem;
        border-radius: 15px;
    }
    .controls-row {
        flex-direction: column;
        text-align: center;
    }
    .track-info {
        text-align: center;
    }

    .album-art {
        margin-bottom: 2rem;
        box-shadow: 0 0 35px var(--shadow);
    }
    .album-art:hover {
        transform: scale(1.06);
        box-shadow: 0 0 40px rgba(255, 51, 51, 0.25);
    }

    #currently-playing-label {
        text-align: center;
        font-size: 1.2rem;
    }
    .volume-container {
        display: flex;
        flex-direction: row-reverse;
        height: auto;
        width: 100%;
        max-width: 220px;
        margin: 0 auto;
        gap: 15px;
    }
    .volume-container input[type="range"] {
        writing-mode: horizontal-tb;
        appearance: auto;
        direction: ltr;
        width: 100%;
        height: 6px;
    }
}

@media(max-width: 480px) {
    .chat-sidebar {
        width: 100%;
        right: -100%;
    }
    .album-art {
        width: 160px;
        height: 160px;
    }
}

@media(min-width: 993px) {
    body {
        overflow: hidden; /* Lock viewport solely for split-panel workspace views */
        height: 100vh;
    }

    #offline-mixcloud-container {
        align-self: start;
        margin-left: 5%;
        margin-top: 1rem;
    }
}