/* ==== RESET & GLOBAL STYLES ==== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: "Roboto", sans-serif;
}

/* ==== ANIMATIONS ==== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==== HEADER ==== */
.header {
    background: #1f233f;
    color: #f5f5f5;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 2000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.header h4 {
    font-size: 18px;
    margin-top: 1.4rem;
}

.header img.logo {
    height: 75px;
    width: auto;
}

.header .input-group {
    width: 50%;
    margin-left: auto;
}

.header .input-group .form-control {
    border-right: none;
}

.header .input-group .btn {
    border-left: none;
}

/* ==== FOOTER ==== */
.footer {
    background: #1f233f;
    color: #f5f5f5;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.2);
    margin-top: auto;
    width: 100%;
}

/* ==== MAIN LAYOUT ==== */
main {
    display: flex;
    flex: 1;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: hidden;
    flex-wrap: wrap;
}

.main-content {
    display: flex;
    flex: 3;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    padding: 20px;
    flex-direction: column;
    overflow-y: auto;
    gap: 20px;
    min-width: 300px;
}

.ads-column {
    flex: 1;
    background: linear-gradient(135deg, #1a1f2e 0%, #2c3e50 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.player-search-container {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

.player-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==== RADIO PLAYER ==== */
.radio-player {
    position: sticky;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    width: fit-content;
    min-width: 400px;
    max-width: 600px;
    padding: 13px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 1000;
    height: fit-content;
}

.radio-player h3 {
    margin-bottom: 9px;
    font-size: 1.1rem;
    color: #1c1c1c;
    transition: color 0.3s ease;
    line-height: 1;
}

.radio-player h3.playing {
    color: #2f2f33;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.player-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

.player-title {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

.player-title h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #1c1c1c;
    flex: 1;
}

/* Player logo styles */
.player-logo {
    width: 80px;
    height: 80px;
    display: none;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.player-logo img, .radio-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player-logo.visible, .radio-logo.visible {
    display: block;
}

.radio-logo {
    width: 100px;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
    margin-left: 15px;
    flex-shrink: 0;
    display: none;
    align-self: center;
    position: relative;
    top: -15px;
}

.radio-logo img {
    padding: 5px;
}

/* Player controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    justify-content: flex-start;
    padding: 5px 0;
    flex-wrap: wrap;
    min-height: 70px;
}

.player-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    background-color: #1f233f;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.7);
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.player-controls .btn:hover {
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

.player-controls .btn i {
    font-size: 20px;
    color: #ffffff;
    transition: all 0.3s ease;
}

/* Loading state */
#loadingIcon {
    animation: spin 1s linear infinite;
    font-size: 24px;
    color: #ffffff;
    display: none;
}

.loading #playIcon {
    display: none;
}

.loading #loadingIcon {
    display: block !important;
}

.player-controls .btn.loading {
    background-color: #2a2f4f;
    cursor: wait;
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 180px;
    max-width: 250px;
    height: 50px;
}

/* Range input styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #d0d0d0;
    border-radius: 5px;
    outline: none;
    opacity: 1;
    transition: background 0.2s ease;
}

input[type="range"]:hover {
    background: #8f8f8f;
}

/* Webkit browsers */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #1f233f;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
}

/* Firefox */
input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 5px;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #1f233f;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

input[type="range"]::-moz-range-progress {
    background: #1f233f;
    height: 6px;
    border-radius: 5px;
}

/* Edge */
input[type="range"]::-ms-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

input[type="range"]::-ms-thumb {
    width: 16px;
    height: 16px;
    background: #1f233f;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-ms-fill-lower {
    background: #1f233f;
    border-radius: 5px;
}

/* Status indicator */
.status-indicator {
    position: absolute;
    bottom: 1px;
    right: 25px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    background-color: transparent;
    padding: 5px 10px;
    border-radius: 5px;
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.status-indicator:not([style*="opacity: 0"]) {
    transform: translateX(12px);
}

.status-indicator[style*="opacity: 0"] {
    transform: translateX(40px);
}

/* ==== RADIO LISTS ==== */
/* Popular radios */
.popular-radios {
    width: 100%;
    max-width: 250px;
    background-color: #ffffff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: fit-content;
    overflow: visible;
}

/* Vertical list */
.radio-list-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.radio-list-vertical .radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

.radio-list-vertical .radio-item:hover {
    background-color: #e9ecef;
}

.radio-list-vertical .radio-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}

.radio-list-vertical .radio-item h5 {
    margin: 0;
    font-size: 1rem;
    color: #1c1c1c;
}

/* Horizontal list */
.radio-list-horizontal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
    padding: 10px;
}

.radio-list-horizontal .radio-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    width: 100%;
    height: auto;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
}

.radio-list-horizontal .radio-item:hover {
    background-color: #e9ecef;
    transform: translateY(-5px);
}

.radio-list-horizontal .radio-item img {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    object-fit: contain;
    margin-bottom: 8px;
}

.radio-list-horizontal .radio-item h5 {
    margin: 0;
    font-size: 0.9rem;
    color: #1f233f;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

/* ==== SEARCH RESULTS ==== */
.search-results {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
    height: auto;
}

.search-results.visible {
    display: block;
}

.search-results h4 {
    margin-bottom: 15px;
    color: #1f233f;
    font-size: 1.1rem;
}

/* ==== HISTORY CONTAINER ==== */
.history-container {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: auto;
    display: block;
}

.history-container h4 {
    margin-bottom: 15px;
    color: #1f233f;
    font-size: 1.1rem;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    width: 100%;
    padding: 10px;
}

.history-list .radio-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    font-size: 0.9rem;
    color: #1f233f;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

.history-list .radio-item:hover {
    background-color: #e9ecef;
    transform: translateY(-5px);
}

.history-list .radio-item img {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    object-fit: contain;
    margin-bottom: 8px;
}

.history-list .radio-item h5 {
    margin: 0;
    font-size: 0.9rem;
    color: #1f233f;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 5px;
}

/* ==== RESPONSIVE DESIGN ==== */
/* Large screens */
@media (max-width: 1200px) {
    .radio-list-horizontal {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium screens */
@media (max-width: 992px) {
    .radio-list-horizontal {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small screens */
@media (max-width: 768px) {
    .header {
        height: 70px;
        padding: 0 10px;
    }

    .footer {
        height: 50px;
    }

    main {
        flex-direction: column;
    }

    .player-search-container {
        flex-direction: column;
    }

    .popular-radios {
        width: 100%;
        margin-top: 20px;
    }

    .search-results {
        width: 100%;
    }

    .main-content,
    .ads-column {
        flex: none;
        width: 100%;
        margin-left: 0;
    }

    .main-content {
        min-height: 60vh;
    }

    .ads-column {
        min-height: 20vh;
    }

    .logo {
        font-size: 3rem;
    }

    .radio-logo {
        width: 90px;
        height: 90px;
        top: -12px;
    }

    .player-controls {
        min-height: 60px;
    }

    .radio-list-horizontal {
        grid-template-columns: repeat(2, 1fr);
    }

    .radio-list-horizontal .radio-item {
        padding: 10px;
    }

    .radio-list-horizontal .radio-item img {
        height: 80px;
    }
}

/* Extra small screens */
@media (max-width: 576px) {
    .radio-list-horizontal {
        gap: 10px;
    }

    .radio-list-horizontal .radio-item {
        padding: 8px;
        min-height: auto;
    }

    .radio-list-horizontal .radio-item img {
        height: 60px;
        margin-bottom: 5px;
    }

    .radio-list-horizontal .radio-item h5 {
        font-size: 0.8rem;
    }

    .radio-player {
        padding: 10px;
    }

    .player-controls .btn i {
        font-size: 16px;
    }

    .volume-control {
        min-width: 120px;
    }

    .player-logo {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 900px) {
    main {
        flex-direction: column;
    }

    .main-content, .ads-content {
        width: 100%;
    }
}