/* Style pour Micro Radio */

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #e94560;
    --text-color: #fff;
    --light-text: #ddd;
    --card-bg: #16213e;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0f3460 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
}

/* En-tête */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    color: var(--accent-color);
}

.tagline {
    font-size: 1.2rem;
    color: var(--light-text);
    margin: 5px 0 0;
}

/* Player Section avec jaquette */
.player-section {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    margin-bottom: 30px;
}

/* Mobile first : vertical */
.track-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
    align-items: center;
    text-align: center;
}

.artwork-container {
    flex-shrink: 0;
}

.track-details-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Grand écran : horizontal avec jaquette à gauche */
@media (min-width: 769px) {
    .track-info {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 30px;
    }
    
    .track-details-wrapper {
        flex: 1;
        align-items: flex-start;
    }
    
    .tags-container {
        justify-content: flex-start;
    }
}

#current-artwork {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 10px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s;
}

#current-artwork:hover {
    transform: scale(1.05);
}

/* Mode Direct dans le player */
.live-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    animation: pulse-red 2s infinite;
    box-shadow: 0 4px 10px var(--shadow-color);
}

.live-badge-player {
    display: inline-block;
    background: #ff0000;
    color: white;
    padding: 6px 16px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.livestream-info #current-track-artist {
    font-size: 1.5rem;
    color: #ff6b6b;
    margin-top: 10px;
}

.track-details {
    flex: 1;
    min-width: 0;
}

#current-track-title {
    font-size: 1.8rem;
    margin: 0 0 5px 0;
    color: var(--text-color);
}

#current-track-artist {
    font-size: 1.2rem;
    margin: 0 0 5px 0;
    color: var(--light-text);
}

.album-name {
    font-size: 1rem;
    margin: 0 0 10px 0;
    color: var(--light-text);
    font-style: italic;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.tag {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--accent-color);
}

.player-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.play-btn.playing {
    background-color: #ff6b6b;
}

.volume-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#volume-slider {
    -webkit-appearance: slider-vertical;
    width: 8px;
    height: 80px;
    writing-mode: bt-lr;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
}

#volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
}

/* History Section */
.history-section {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    margin-bottom: 30px;
}

h3 {
    color: var(--accent-color);
    margin-top: 0;
    font-size: 1.5rem;
    text-align: center;
}

.history-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.history-controls input,
.history-controls select,
.history-controls button {
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

/* Petits boutons de navigation */
#prev-day-btn,
#today-btn {
    flex-shrink: 0;
}

/* Empêcher les inputs/selects d'être trop petits */
#date-picker,
#hour-picker {
    min-width: 150px;
}

.history-controls select option {
    background: var(--card-bg);
    color: var(--text-color);
}

.history-controls button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: 600;
}

.history-controls button:hover {
    background-color: #ff6b6b;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

#search-input {
    width: 100%;
    padding-right: 40px;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--light-text);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.clear-btn.visible {
    opacity: 0.6;
    pointer-events: auto;
}

.clear-btn.visible:hover {
    opacity: 1;
    color: var(--accent-color);
}

#history-content {
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* History Item avec timeline */
.history-item {
    display: flex;
    gap: 15px;
    padding: 25px 10px;
    margin-bottom: 0;
    background: transparent;
    position: relative;
    transition: background 0.2s;
    align-items: flex-start;
    width: 100%;
    max-width: 900px;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.history-item::before {
    content: '';
    position: absolute;
    left: 62px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.1) 45%, 
        transparent 45%, 
        transparent 55%, 
        rgba(255, 255, 255, 0.1) 55%, 
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 2px 20px;
}

.history-item:last-child::before {
    display: none;
}

.history-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 105px;
    position: relative;
    z-index: 1;
    gap: 8px;
    margin-top: -20px;
}

.history-time {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
    background: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    margin-top: 0px;
}

.history-artwork {
    flex-shrink: 0;
}

.history-artwork img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.history-artwork img:hover {
    transform: scale(1.05);
}

.history-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 30px;
}

.history-title {
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.3;
}

.history-artist {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: bold;
}

.history-album {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-bottom: 8px;
}

.track-expand-btn {
    width: 20px;
    height: 20px;
    background: transparent;
    color: var(--light-text);
    border: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    margin-top: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.track-expand-btn:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.history-item .track-details {
    display: none;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--light-text);
    line-height: 1.6;
}

.history-item .track-details.show {
    display: block;
}

.track-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.track-moods {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.mood-tag {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--accent-color);
}

.track-download-item {
    display: block;
    text-align: left;
    margin-top: 8px;
}

.track-download-link {
    display: none;
    font-size: 1rem;
    opacity: 0.5;
    transition: all 0.2s;
    text-decoration: none;
}

.track-download-link:hover {
    opacity: 1;
    transform: scale(1.3);
}

body.downloads-enabled .track-download-link {
    display: inline;
}

.history-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    align-items: flex-start;
    margin-top: 50px;
}

.btn-download {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-download:hover {
    background: #ff6b6b;
    transform: translateY(-2px);
}

.btn-download:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.loading, .error {
    text-align: center;
    padding: 30px;
    color: var(--light-text);
}

.error {
    color: #ff6b6b;
}

.load-more-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 30px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.load-more-btn:hover {
    background-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

/* Styles pour les différents types d'entrées */

/* LIVESTREAM (Direct) */
.history-livestream {
    background: linear-gradient(90deg, rgba(255, 0, 0, 0.1) 0%, transparent 100%);
    border-left: 4px solid #ff0000;
    padding-bottom: 40px;
}

.history-livestream::before {
    left: 59px !important;
}

.live-icon {
    font-size: 2.5rem;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.live-badge {
    display: inline-block;
    background: #ff0000;
    color: white;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
    width: fit-content;
}

.history-livestream .history-title {
    font-size: 1.1rem;
    color: #ff6b6b;
}

/* SHOW (Nouvelle émission) */
.history-show {
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.1) 0%, transparent 100%);
    border-left: 4px solid #007bff;
    padding-bottom: 40px;
}

.history-show::before {
    left: 59px !important;
}

.show-icon {
    font-size: 2.5rem;
}

.show-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
    width: fit-content;
}

.history-show .history-title {
    font-size: 1.2rem;
    color: #4dabf7;
    font-weight: bold;
}

.show-description {
    color: var(--light-text);
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.4;
    font-style: italic;
}

/* TRACK (style par défaut déjà existant) */
.history-track {
    /* Les styles existants s'appliquent déjà */
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--light-text);
    font-size: 0.95rem;
    position: relative;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ff6b6b;
    text-decoration: underline;
}

.secret-toggle {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.3s ease;
    user-select: none;
}

.secret-toggle:hover {
    opacity: 1;
    transform: scale(1.3);
}

.secret-toggle.active {
    opacity: 1;
}

/* Modal pour zoom jaquette */
.artwork-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.artwork-modal.show {
    display: flex;
}

.artwork-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .track-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    #current-artwork {
        width: 200px;
        height: 200px;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .history-controls input,
    .history-controls select,
    .history-controls button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .player-section,
    .history-section {
        padding: 15px;
    }
    
    /* Jaquette player plus grande sur mobile */
    #current-artwork {
        width: 220px;
        height: 220px;
    }
    
    /* Historique ultra-compact et centré */
    .history-item {
        flex-direction: column;
        padding: 20px 10px;
        gap: 8px;
        position: relative;
        align-items: center;
        text-align: center;
    }
    
    .history-timeline {
        flex-direction: column;
        align-items: center;
        min-width: auto;
        width: 100%;
        gap: 8px;
        margin-top: 0;
    }
    
    .history-time {
        margin-top: 0;
        order: -1; /* Place l'heure en premier */
    }
    
    .history-artwork {
        order: 0;
    }
    
    .history-artwork img {
        width: 120px;
        height: 120px;
    }
    
    .history-details {
        margin-top: 0;
        width: 100%;
        padding-right: 0;
        align-items: center;
        text-align: center;
    }
    
    .history-item::before {
        display: none;
    }
    
    .history-actions {
        position: absolute;
        top: 10px;
        right: 10px;
        margin-top: 0;
        z-index: 10;
    }
    
    .track-expand-btn {
        width: 28px;
        height: 28px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
    }
    
    /* Direct et émissions centrés */
    .live-icon,
    .show-icon {
        font-size: 2rem;
        order: 0;
    }
    
    .history-livestream,
    .history-show {
        min-height: auto;
    }
    
    .history-livestream .history-details,
    .history-show .history-details {
        align-items: center;
    }
}
