﻿/* ============================================
   BASE STYLES
   ============================================ */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 20px;
    padding-bottom: 80px; /* Space for player bar */
}

/* ============================================
   LOGIN MODAL - Special styling
   ============================================ */

#loginModal .modal-content {
    max-width: 380px;
    width: 90%;
}

#loginModal h3 {
    color: #2c3e50;
    margin-top: 0;
    font-size: 22px;
}

#loginModal p {
    color: #666;
    font-size: 14px;
    margin: 10px 0 15px 0;
}

#loginInput {
    width: 80%;
    padding: 10px 12px;
    margin: 10px 0 15px 0;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s;
    text-align: center;
    letter-spacing: 2px;
}

    #loginInput:focus {
        outline: none;
        border-color: #0078d7;
        box-shadow: 0 0 5px rgba(0, 120, 215, 0.3);
    }

    #loginInput.error {
        border-color: #dc3545;
        animation: shake 0.5s;
    }

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

#loginModal .modal-content button {
    padding: 10px 40px;
    font-size: 16px;
    cursor: pointer;
    background-color: #0078d7;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
}

    #loginModal .modal-content button:hover {
        background-color: #005fa3;
        transform: scale(1.02);
    }

    #loginModal .modal-content button:active {
        transform: scale(0.98);
    }

#loginError {
    color: #dc3545;
    margin-top: 12px;
    font-size: 14px;
    display: none;
    padding: 8px;
    background: #f8d7da;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
}

/* Login modal responsive */
@media (max-width: 480px) {
    #loginModal .modal-content {
        padding: 20px;
    }

    #loginModal h3 {
        font-size: 18px;
    }

    #loginInput {
        width: 90%;
        font-size: 14px;
        padding: 8px 10px;
    }

    #loginModal .modal-content button {
        padding: 8px 30px;
        font-size: 14px;
    }
}

/* ============================================
   FILTER CONTROLS
   ============================================ */

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-weight: bold;
    color: #333;
    min-width: 70px;
}

.filter-dropdown {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-width: 150px;
}

/* ============================================
   VIEW TOGGLE BUTTONS
   ============================================ */

.view-toggle {
    display: inline-flex;
    gap: 5px;
    margin-left: auto;
    vertical-align: middle;
}

.view-btn {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
    font-weight: 500;
}

    .view-btn:hover {
        background: #e0e0e0;
    }

    .view-btn.active {
        background: #0078d7;
        color: #fff;
        border-color: #0078d7;
    }

/* ============================================
   RADIO CARDS - GRID VIEW (DEFAULT)
   ============================================ */

.grid-view {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

    .grid-view .radio-card {
        flex: 1 1 calc(25% - 15px);
        max-width: calc(25% - 15px);
        display: block;
        text-align: center;
        padding: 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        background: #f9f9f9;
        transition: 0.3s;
    }

        .grid-view .radio-card:hover {
            background: #eee;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .grid-view .radio-card.playing {
            border: 2px solid #0078d7;
            background: #e6f0ff;
        }

    .grid-view .radio-logo {
        width: 120px;
        height: 120px;
        margin: 0 auto 10px;
        border-radius: 10px;
        object-fit: cover;
        background: #f0f0f0;
    }

    .grid-view .radio-info {
        margin: 10px 0;
    }

        .grid-view .radio-info strong {
            display: block;
            font-size: 16px;
            margin-bottom: 4px;
        }

        .grid-view .radio-info small {
            color: #666;
            font-size: 12px;
        }

    .grid-view .play-btn {
        width: 100%;
        margin-top: 10px;
        padding: 8px;
    }

/* ============================================
   RADIO CARDS - LIST VIEW
   ============================================ */

.list-view .radio-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 5px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f9f9f9;
    transition: 0.3s;
}

    .list-view .radio-card:hover {
        background: #eee;
    }

    .list-view .radio-card.playing {
        border: 2px solid #0078d7;
        background: #e6f0ff;
    }

.list-view .radio-logo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.list-view .radio-info {
    flex-grow: 1;
    text-align: left;
}

    .list-view .radio-info strong {
        display: block;
        font-size: 16px;
        margin-bottom: 2px;
    }

    .list-view .radio-info small {
        color: #666;
        font-size: 12px;
    }

.list-view .play-btn {
    flex-shrink: 0;
    padding: 6px 16px;
}

/* ============================================
   PLAY BUTTONS
   ============================================ */

.play-btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    font-size: 14px;
}

.btn-play {
    background: #28a745;
    color: white;
}

    .btn-play:hover {
        background: #218838;
    }

.btn-stop {
    background: #dc3545;
    color: white;
}

    .btn-stop:hover {
        background: #b52a37;
    }

/* ============================================
   NO RESULTS MESSAGE
   ============================================ */

.no-results {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

    .no-results p {
        color: #666;
        font-size: 16px;
        margin: 0;
    }

/* ============================================
   ERROR MESSAGE
   ============================================ */

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    display: block;
    margin: 10px 0;
}

/* ============================================
   NOW PLAYING BAR
   ============================================ */

#nowPlaying {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 10px 20px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    min-height: 54px;
}

#nowPlayingContent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 10px;
}

#nowPlayingInfo {
    flex: 1;
    text-align: left;
    font-size: 14px;
}

#nowPlayingStation {
    font-weight: bold;
    color: #fff;
}

#nowPlayingControls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#streamStatus {
    font-size: 12px;
    color: #f1c40f;
    display: inline-block;
}

#stopButton {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    font-size: 14px;
}

    #stopButton:hover {
        background: #c0392b;
    }

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 320px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

    .modal-content h3 {
        margin-top: 0;
    }

#modalInput {
    width: 80%;
    padding: 8px;
    margin: 12px 0;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-content button {
    padding: 8px 16px;
    font-size: 16px;
    cursor: pointer;
    background-color: #0078d7;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background 0.3s;
}

    .modal-content button:hover {
        background-color: #005fa3;
    }

/* ============================================
   FLOATING INFO BUTTON
   ============================================ */

#infoFloating {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: #0078d7;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    z-index: 10000;
    transition: background 0.3s, transform 0.2s;
    user-select: none;
}

    #infoFloating:hover {
        background-color: #005fa3;
        transform: scale(1.1);
    }

/* ============================================
   INFO MESSAGE
   ============================================ */

#infoMessage {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 20px;
    background-color: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
    max-width: 300px;
    font-size: 14px;
    color: #333;
    z-index: 10000;
    border-left: 4px solid #0078d7;
    line-height: 1.5;
}

    #infoMessage strong {
        color: #0078d7;
    }

#infoClose {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
    font-weight: bold;
}

    #infoClose:hover {
        color: #333;
    }

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet - 3 columns */
@media (max-width: 1024px) {
    .grid-view .radio-card {
        flex: 1 1 calc(33.33% - 15px);
        max-width: calc(33.33% - 15px);
    }
}

/* Mobile - 2 columns */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 70px;
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-dropdown {
        width: 100%;
    }

    .view-toggle {
        margin-left: 0;
        justify-content: center;
    }

    .grid-view .radio-card {
        flex: 1 1 calc(50% - 10px);
        max-width: calc(50% - 10px);
        padding: 12px;
    }

    .grid-view .radio-logo {
        width: 80px;
        height: 80px;
    }

    .grid-view .radio-info strong {
        font-size: 14px;
    }

    /* List view mobile */
    .list-view .radio-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }

    .list-view .radio-logo {
        width: 80px;
        height: 80px;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .list-view .radio-info {
        margin-bottom: 10px;
        font-size: 16px;
        width: 100%;
    }

    .list-view .play-btn {
        width: 100%;
        font-size: 16px;
        padding: 10px;
    }

    /* Now playing on mobile */
    #nowPlaying {
        padding: 8px 12px;
        min-height: 48px;
    }

    #nowPlayingContent {
        gap: 5px;
    }

    #nowPlayingInfo {
        font-size: 12px;
    }

    #nowPlayingControls {
        gap: 8px;
    }

    #streamStatus {
        font-size: 10px;
    }

    #stopButton {
        padding: 4px 12px;
        font-size: 12px;
    }

    #infoFloating {
        bottom: 65px;
        width: 40px;
        height: 40px;
        font-size: 18px;
        right: 10px;
    }

    #infoMessage {
        bottom: 70px;
        right: 10px;
        max-width: 220px;
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Small mobile - 1 column */
@media (max-width: 480px) {
    body {
        padding-bottom: 60px;
    }

    .grid-view .radio-card {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .grid-view .radio-logo {
        width: 100px;
        height: 100px;
    }

    #nowPlayingInfo {
        font-size: 11px;
    }

    #streamStatus {
        font-size: 9px;
    }

    #stopButton {
        padding: 3px 10px;
        font-size: 11px;
    }

    .modal-content {
        width: 90%;
        margin: 0 10px;
    }

    #infoFloating {
        bottom: 55px;
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}
