/**
 * Prank Circuit Web Player - Stylesheet
 * 
 * Modern, responsive CSS for the SHOUTCast radio player.
 * Features: gradient backgrounds, animations, responsive layout,
 * timer modal, media controls, and stats display.
 * 
 * Container queries are used for responsive typography sizing.
 *
 * @version 1.0.44
 */

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0b0f14;
    background-image: url("phone_circuit_tile_with_phone_1024_50pct.png");
    background-repeat: repeat;
    background-size: 1024px 1024px;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    color: #333;
    padding: 10px;
    position: relative;
    overflow-x: hidden;
}

/* Subtle overlay for better contrast */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(100, 255, 218, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(138, 43, 226, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 1;
    margin: auto 0;
    container-type: inline-size;
}

/* ==========================================================================
   Header
   ========================================================================== */
header {
    text-align: center;
    margin-bottom: 20px;
    color: #64ffda;
    width: 100%;
}

header h1 {
    font-size: clamp(1.8rem, 10.5cqi, 4rem);
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 
        0 0 8px rgba(100, 255, 218, 0.5),
        0 0 16px rgba(100, 255, 218, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.tagline {
    font-size: clamp(0.9rem, 6.5cqi, 2rem);
    font-style: italic;
    color: #a0e9d6;
    text-shadow: 
        0 0 8px rgba(160, 233, 214, 0.6),
        0 0 16px rgba(160, 233, 214, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

/* ==========================================================================
   Player Card
   ========================================================================== */
.player-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-radius: 20px;
    padding: clamp(15px, 5vw, 24px);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(100, 255, 218, 0.1),
        inset 0 1px 0 rgba(100, 255, 218, 0.1);
    border: 3px solid rgba(100, 255, 218, 0.2);
    backdrop-filter: blur(10px);
}

@media (max-width: 400px) {
    .player-card {
        padding: 20px;
        border-radius: 15px;
    }
}

/* ==========================================================================
   Now Playing Section
   ========================================================================== */
.now-playing {
    text-align: center;
    text-wrap: wrap;
    min-height: 100px;
    margin-bottom: 30px;
    padding: clamp(15px, 4vw, 20px);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 15px;
    border: 2px solid rgba(100, 255, 218, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
}

.track-title {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    font-weight: bold;
    max-width: 100%;
    padding-right: 3rem;
    min-height: 4.5em;
    line-height: 1.5;
    color: #64ffda;
    text-shadow: 0 0 8px rgba(100, 255, 218, 0.3);
    word-break: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    color: #a0e9d6;
}

/* ==========================================================================
   Player Controls
   ========================================================================== */
.player-controls {
    display: flex;
    justify-content: center;
    gap: clamp(15px, 4vw, 20px);
    margin-bottom: 30px;
}

.control-btn {
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(100, 255, 218, 0.2);
    position: relative;
}

.control-btn::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, #64ffda, #8b5cf6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.control-btn:hover:not(:disabled)::before {
    opacity: 1;
}

.control-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(100, 255, 218, 0.4);
}

.control-btn:active:not(:disabled) {
    transform: scale(1.05);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.play-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.stop-btn {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    color: white;
}

.catalog-link {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
    color: #0b0f14;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.35),
        0 0 12px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-link:hover {
    transform: translateY(-1px);
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(99, 102, 241, 0.5);
}

.catalog-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.donate-link {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #ffdd00 0%, #ff813f 100%);
    color: #0b0f14;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.35),
        0 0 12px rgba(255, 221, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.donate-link:hover {
    transform: translateY(-1px);
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.4),
        0 0 16px rgba(255, 221, 0, 0.5);
}

.donate-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.icon {
    width: clamp(30px, 8vw, 40px);
    height: clamp(30px, 8vw, 40px);
}

/* ==========================================================================
   Volume Control
   ========================================================================== */
.volume-control {
    display: flex;
    align-items: center;
    gap: clamp(10px, 3vw, 15px);
    margin-bottom: 30px;
    padding: clamp(15px, 4vw, 20px);
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    border: 2px solid rgba(100, 255, 218, 0.1);
}

.volume-icon {
    width: 24px;
    height: 24px;
    color: #64ffda;
    flex-shrink: 0;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: rgba(100, 255, 218, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-width: 0; /* Prevents flex item overflow in narrow containers */
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #64ffda 0%, #8b5cf6 100%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.7);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #64ffda 0%, #8b5cf6 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.7);
}

.volume-value {
    min-width: 50px;
    text-align: right;
    font-weight: bold;
    color: #64ffda;
    font-size: clamp(0.9rem, 3vw, 1rem);
    flex-shrink: 0;
}

/* ==========================================================================
   Stats Section
   ========================================================================== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(80px, 20vw, 100px), 1fr));
    gap: clamp(10px, 3vw, 15px);
    padding-top: 20px;
    border-top: 2px solid rgba(100, 255, 218, 0.2);
    align-items: center;
}

.stat-item {
    text-align: center;
    background: rgba(100, 255, 218, 0.05);
    border-radius: 8px;
    padding: 5px 10px;
    border: 2px solid rgba(100, 255, 218, 0.1); 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;    
    align-items: center;
    justify-content: center;
    gap: 5px;
} 

.stat-item > div {
    display: flex;
    align-items: center;
    gap: 3px;
}

.stat-icon { 
    width: 24px;
    height: 24px;
}

.stat-label {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #a0e9d6;
    text-transform: uppercase;
    line-height: 1;
    text-shadow: 0 0 8px rgba(160, 233, 214, 0.3);
}

.stat-value {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    font-weight: bold;
    color: #64ffda;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(100, 255, 218, 0.3);
}

/* Clickable stat link */
.stat-link {
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stat-link:hover {
    border-color: rgba(100, 255, 218, 0.4);
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.2);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    text-align: center;
    margin-top: 10px;
    color: #64ffda;
    opacity: 0.7;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
}

footer a,
footer a:visited {
    color: #64ffda;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #a0e9d6;
    text-decoration: underline;
}

.promo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.90;
    transition: opacity 0.3s ease;
}

.promo-badge:hover {
    opacity: 1;
}

.promo-badge img {
    width: 100%;
    max-width: 180px;
    height: auto;
    vertical-align: middle;
}

/* Promo badges row - reuses .stats grid with added top spacing */
.promo-badges-row {
    margin-top: 20px;
    grid-template-columns: repeat(3, 1fr);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 600px) {
    .player-card {
        padding: 25px;
    }

    .control-btn {
        width: 80px;
        height: 80px;
    }

    .icon {
        width: 40px;
        height: 40px;
    }

    .stats {
        grid-template-columns: 1fr;
        text-size-adjust: 115%;
        gap: 10px;
    }

    .stat-icon {
        justify-content: flex-start;
        
    }

    .stat-item {
        flex-direction: row;
        justify-content: space-between;
    }

    .stat-label {
        padding-left: 5px;
        padding-top: 5px;
    }
}

/* Tablet specific adjustments */
@media (min-width: 601px) and (max-width: 1024px) {
    .container {
        max-width: 500px;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large desktop adjustments */
@media (min-width: 1025px) {
    .container {
        max-width: 600px;
    }
}

/* ==========================================================================
   Status Colors
   ========================================================================== */
.stat-value.playing {
    color: #22c55e;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.stat-value.stopped {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.stat-value.loading {
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* ==========================================================================
   Timer Modal
   ========================================================================== */

/* Timer Button */
.timer-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

/* Timer Modal Overlay */
.timer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timer-modal.visible {
    display: flex;
    opacity: 1;
}

/* Timer Modal Content */
.timer-modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 350px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(100, 255, 218, 0.2);
    border: 1px solid rgba(100, 255, 218, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.timer-modal.visible .timer-modal-content {
    transform: scale(1);
}

.timer-title {
    color: #64ffda;
    font-size: 1.5rem;
    margin-bottom: 25px;
    text-align: left;
    font-weight: 600;
}

/* Timer Picker Container */
.timer-picker-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.timer-picker-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-picker-label {
    color: #a0e9d6;
    font-size: 0.9rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Picker Wheel */
.timer-picker-wheel {
    height: 150px;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 30%,
        black 70%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 30%,
        black 70%,
        transparent 100%
    );
}

.timer-picker-wheel::-webkit-scrollbar {
    display: none;
}

.picker-item {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #64ffda;
    scroll-snap-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    opacity: 0.4;
}

.picker-item:hover {
    opacity: 0.7;
}

.picker-item.selected {
    opacity: 1;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

/* Timer Modal Buttons */
.timer-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

.timer-modal-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
}

.timer-modal-btn.cancel-btn {
    color: #64ffda;
}

.timer-modal-btn.cancel-btn:hover {
    background: rgba(100, 255, 218, 0.1);
}

.timer-modal-btn.start-btn {
    color: #64ffda;
}

.timer-modal-btn.start-btn:hover {
    background: rgba(100, 255, 218, 0.1);
}

/* Timer Active State */
.timer-btn.timer-active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    animation: timerPulse 2s infinite;
}

/* ==========================================================================
   Catalog Popover
   ========================================================================== */

/* Catalog Popover */
.catalog-popover {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.catalog-popover.visible {
    display: flex;
    opacity: 1;
}

.catalog-popover-content {
    width: min(92vw, 900px);
    height: min(80vh, 720px);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-radius: 18px;
    border: 1px solid rgba(100, 255, 218, 0.3);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(100, 255, 218, 0.2);
    transform: scale(0.96);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.catalog-popover.visible .catalog-popover-content {
    transform: scale(1);
}

.catalog-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    background: rgba(15, 23, 42, 0.8);
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(6px);
}

.catalog-popover-title {
    font-size: 1.1rem;
    color: #64ffda;
    margin: 0;
    font-weight: 600;
}

.catalog-popover-close {
    border: none;
    background: rgba(100, 255, 218, 0.85);
    color: #0b0f14;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.catalog-popover-close:hover {
    background: rgba(100, 255, 218, 1);
    color: #0b0f14;
}

.catalog-popover-close svg {
    width: 20px;
    height: 20px;
}

.catalog-iframe {
    flex: 1;
    width: 100%;
    border: 0;
    background: #0b0f14;
}

@media (max-width: 600px) {
    .catalog-popover {
        align-items: flex-start;
    }

    .catalog-popover-content {
        width: 100vw;
        height: calc(100dvh - env(safe-area-inset-top));
        margin-top: env(safe-area-inset-top);
        border-radius: 0;
    }

    .catalog-popover-header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
}

@keyframes timerPulse {
    0%, 100% {
        box-shadow: 
            0 4px 6px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 
            0 4px 6px rgba(0, 0, 0, 0.3),
            0 0 30px rgba(245, 158, 11, 0.6);
    }
}
