/**
 * Radio Cards - Stiluri îmbunătățite
 * Versiune: 1.0
 * Data: 4 Decembrie 2025
 */

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    position: relative;
    z-index: 10;
}

.filters-bar .form-select,
.filters-bar .form-control {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    font-size: 0.875rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Custom styled select dropdowns */
.filters-bar .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dc3545' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px 10px;
    padding-right: 2.25rem;
}

/* Limit dropdown height and add scroll */
.filters-bar .form-select option {
    padding: 8px 12px;
}

/* Modern dropdown styling using datalist alternative or custom select */
.filters-bar .form-select::-webkit-scrollbar {
    width: 6px;
}

.filters-bar .form-select::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.filters-bar .form-select::-webkit-scrollbar-thumb {
    background: #dc3545;
    border-radius: 3px;
}

.filters-bar .form-select:focus,
.filters-bar .form-control:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

/* Reset filter button */
.filters-bar .btn-outline-secondary {
    border-color: #dc3545;
    color: #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filters-bar .btn-outline-secondary:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.filters-bar .btn-outline-secondary i {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   CUSTOM SELECT DROPDOWN
   ============================================ */
.rc-select-wrapper {
    position: relative;
    width: 100%;
}

.rc-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.rc-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.rc-select__trigger:hover {
    border-color: #dc3545;
}

.rc-select__trigger span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.rc-select__trigger i {
    color: #dc3545;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.rc-select.open .rc-select__trigger {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.rc-select.open .rc-select__trigger i {
    transform: rotate(180deg);
}

.rc-select__options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border: 1px solid #dc3545;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 180px;
    overflow-y: auto;
    z-index: 100;
    /* Ascunde complet dropdown-ul by default */
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.rc-select.open .rc-select__options {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rc-select__option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--bs-border-color);
}

.rc-select__option:last-child {
    border-bottom: none;
}

.rc-select__option:hover {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

.rc-select__option.selected {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    font-weight: 500;
}

.rc-select__option.selected::before {
    content: '✓';
    margin-right: 8px;
    font-weight: bold;
}

/* Custom scrollbar for options */
.rc-select__options::-webkit-scrollbar {
    width: 6px;
}

.rc-select__options::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.rc-select__options::-webkit-scrollbar-thumb {
    background: #dc3545;
    border-radius: 3px;
}

.rc-select__options::-webkit-scrollbar-thumb:hover {
    background: #c82333;
}

/* Dark mode support */
[data-theme="dark"] .rc-select__options {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* View Toggle Buttons */
.view-toggle .btn {
    padding: 0.375rem 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-color: #dc3545;
    color: #dc3545;
}

.view-toggle .btn:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #dc3545;
}

.view-toggle .btn.active {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.view-toggle .btn i {
    font-size: 1.1rem;
    line-height: 1;
}

/* ============================================
   RADIO CARDS GRID
   ============================================ */
.radio-cards-grid {
    --card-gap: 1.5rem;
}

.radio-cards-grid.list-view {
    --card-gap: 1rem;
}

/* List view: 2 items per row on desktop, 1 on mobile */
.radio-cards-grid.list-view .card-item {
    flex: 0 0 50%;
    max-width: 50%;
}

@media (max-width: 767.98px) {
    .radio-cards-grid.list-view .card-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.radio-cards-grid.list-view .radio-card {
    flex-direction: row;
    align-items: center;
    padding: 0.5rem;
}

.radio-cards-grid.list-view .radio-card__image {
    width: 70px;
    min-width: 70px;
    height: 70px;
    border-radius: 10px;
    margin-right: 0.875rem;
    aspect-ratio: 1;
}

.radio-cards-grid.list-view .radio-card__badge {
    font-size: 0.55rem;
    padding: 2px 5px;
    top: 5px;
    left: 5px;
}

.radio-cards-grid.list-view .radio-card__badge i {
    font-size: 0.6rem;
}

.radio-cards-grid.list-view .radio-card__play {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.radio-cards-grid.list-view .radio-card__body {
    padding: 0;
    flex: 1;
    min-width: 0;
}

.radio-cards-grid.list-view .radio-card__title {
    font-size: 0.9rem;
}

.radio-cards-grid.list-view .radio-card__meta {
    margin-top: 2px;
}

.radio-cards-grid.list-view .radio-card__category {
    font-size: 0.75rem;
}

.radio-cards-grid.list-view .radio-card__stats {
    gap: 6px;
}

.radio-cards-grid.list-view .radio-card__views,
.radio-cards-grid.list-view .radio-card__rating {
    font-size: 0.7rem;
}

/* ============================================
   RADIO CARD COMPONENT
   ============================================ */
.radio-card {
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.radio-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
}

/* Hover pe card activ - rămâne verde */
.card-item.active .radio-card:hover {
    border-color: #28a745;
    box-shadow: 0 12px 40px rgba(40, 167, 69, 0.25);
}

/* Dark mode adjustments */
[data-theme="dark"] .radio-card {
    background: var(--bs-tertiary-bg);
}

[data-theme="dark"] .radio-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ============================================
   RADIO CARD IMAGE
   ============================================ */
.radio-card__image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bs-tertiary-bg);
}

.radio-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

/* Image Link - clickabil pe toată imaginea */
.radio-card__image-link {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    cursor: pointer;
}

/* Pe radios.php (fără buton play) link-ul e deasupra dar sub badge */
.card-item[data-card-radio-id] .radio-card__image-link {
    z-index: 2;
}

/* Badge-ul LIVE trebuie să fie mereu vizibil */
.card-item[data-card-radio-id] .radio-card__badge {
    z-index: 3;
}

/* Flag-ul țării trebuie să fie mereu vizibil */
.card-item[data-card-radio-id] .radio-card__flag {
    z-index: 3;
}

.radio-card__image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.radio-card:hover .radio-card__image-link img,
.radio-card:hover .radio-card__image img {
    transform: scale(1.08);
}

/* Live Badge */
.radio-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    animation: pulse-live 2s infinite;
}

.radio-card__badge i {
    font-size: 0.7rem;
    animation: blink 1s infinite;
}

@keyframes pulse-live {
    0%, 100% { box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(220, 53, 69, 0.6); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Active/Playing state - badge becomes green */
.radio-card.is-playing .radio-card__badge,
.card-item.active .radio-card__badge,
.radio-card:has(.radio-card__play.active) .radio-card__badge {
    background: linear-gradient(135deg, #28a745, #218838);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
    animation: pulse-live-green 2s infinite;
}

@keyframes pulse-live-green {
    0%, 100% { box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(40, 167, 69, 0.6); }
}

/* Active card styling - only border green */
.radio-card.is-playing,
.card-item.active .radio-card,
.radio-card:has(.radio-card__play.active) {
    border-color: #28a745;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.15);
}

/* When active: button hidden by default, shows on hover with pause icon */
.radio-card__play.active {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

/* Show pause button on hover when active */
.radio-card:hover .radio-card__play.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    background: #dc3545; /* Red for pause */
}

/* Change icon to pause when active */
.radio-card__play.active .ri-play-fill::before {
    content: "\eb7e"; /* Remix icon pause-fill code */
}

/* Alternative: hide play icon, show pause icon */
.radio-card__play .pause-icon {
    display: none;
}

.radio-card__play.active .play-icon {
    display: none;
}

.radio-card__play.active .pause-icon {
    display: block;
}

/* Play Button Overlay */
.radio-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 56px;
    height: 56px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.5);
    cursor: pointer;
}

.radio-card__play i {
    margin-left: 3px; /* Optical centering for play icon */
}

.radio-card:hover .radio-card__play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.radio-card__play:hover {
    background: #218838;
    transform: translate(-50%, -50%) scale(1.1) !important;
}

/* Image Overlay on Hover */
.radio-card__image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.radio-card:hover .radio-card__image::after {
    opacity: 1;
}

/* ============================================
   RADIO CARD BODY
   ============================================ */
.radio-card__body {
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bs-body-color);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.radio-card__title:hover {
    color: var(--primary);
}

/* Culoare roșie când ții click pe link */
.radio-card__title:active {
    color: var(--primary) !important;
}

/* Category + Stats Row (inline) */
.radio-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.radio-card__category {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Stats (views) */
.radio-card__stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.radio-card__rating,
.radio-card__views {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.radio-card__rating i {
    color: #ffc107;
    font-size: 0.8rem;
}

.radio-card__views i {
    color: #dc3545;
    font-size: 0.75rem;
}

/* ============================================
   NO RESULTS MESSAGE
   ============================================ */
.no-results {
    background: var(--bs-tertiary-bg);
    border-radius: 16px;
    margin-top: 1rem;
}

.no-results i {
    opacity: 0.5;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 767.98px) {
    .filters-bar {
        padding: 0.75rem;
    }
    
    .filters-bar .row {
        gap: 0.5rem;
    }
    
    .radio-card__badge {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
    
    .radio-card__play {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .radio-card__body {
        padding: 0.75rem;
    }
    
    .radio-card__title {
        font-size: 0.85rem;
    }
    
    .radio-card__category {
        font-size: 0.75rem;
    }
    
    .radio-card__stats {
        gap: 8px;
    }
    
    .view-toggle {
        display: none; /* Hide on mobile */
    }
}

@media (max-width: 575.98px) {
    .card-item {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .radio-card {
        border-radius: 12px;
    }
    
    .radio-card__image {
        border-radius: 12px 12px 0 0;
    }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */
.card-item {
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.card-item:nth-child(1) { animation-delay: 0.05s; }
.card-item:nth-child(2) { animation-delay: 0.1s; }
.card-item:nth-child(3) { animation-delay: 0.15s; }
.card-item:nth-child(4) { animation-delay: 0.2s; }
.card-item:nth-child(5) { animation-delay: 0.25s; }
.card-item:nth-child(6) { animation-delay: 0.3s; }
.card-item:nth-child(7) { animation-delay: 0.35s; }
.card-item:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter transition */
.card-item.hiding {
    animation: fadeOut 0.2s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ============================================
   SKELETON LOADING (optional)
   ============================================ */
.radio-card.skeleton .radio-card__image,
.radio-card.skeleton .radio-card__title,
.radio-card.skeleton .radio-card__category,
.radio-card.skeleton .radio-card__stats {
    background: linear-gradient(90deg, var(--bs-tertiary-bg) 25%, var(--bs-secondary-bg) 50%, var(--bs-tertiary-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.radio-card.skeleton .radio-card__title {
    height: 1.2rem;
    width: 80%;
}

.radio-card.skeleton .radio-card__category {
    height: 0.9rem;
    width: 60%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
