/**
 * Eikaiwa.fm Radio Player Styles
 * Compact layout - Full-featured player matching existing site design
 */

#eikaiwa-radio-player {
    font-family: Arial, sans-serif;
    font-size: 12px;
    text-align: center;
    padding: 2px 2px 8px 2px;
    background-color: #FFFFFF;
    max-width: 100%;
    width: calc(100% - 4px);
    margin: 0 auto;
    box-sizing: border-box;
}

/* Now Playing Section */
#now-playing {
    margin-bottom: 6px;
    padding: 6px;
    background-color: #f9f9f9;
    border: 1px solid #C6C47B;
    border-radius: 3px;
    width: 100%;
    box-sizing: border-box;
}

#track-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    margin-bottom: 0;
}

#track-artist {
    display: none; /* Hidden to save vertical space */
    font-size: 11px;
    color: #666;
}

/* Progress Bar Container - Hidden by default, shown when track is loaded */
#progress-container {
    margin-bottom: 6px;
    display: none;
}

#progress-container.active {
    display: block;
}

#progress-bar {
    width: 100%;
    height: 4px;
    background-color: #E7E3B5;
    border: 1px solid #C6C47B;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 4px;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background-color: #8C1414;
    transition: width 0.1s linear;
}

#time-display {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* Control Row - Buttons + Status */
#control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    gap: 8px;
}

/* Main Player Controls */
#player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex: 1;
}

#player-controls button {
    background-color: transparent;
    color: #333;
    border: none;
    padding: 0;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 0 0 auto;
    line-height: 1;
}

#player-controls button:hover {
    background-color: rgba(198, 196, 123, 0.15);
    transform: scale(1.1);
    border-radius: 4px;
}

#player-controls button:active {
    background-color: rgba(198, 196, 123, 0.3);
    transform: scale(0.95);
}

#play-btn,
#pause-btn {
    padding: 0;
    font-weight: bold;
    font-size: 36px;
    color: #8C1414;
}

#play-btn:hover,
#pause-btn:hover {
    transform: scale(1.15);
    color: #6B0F0F;
}

/* Volume & Speed Row - Combined on one line */
#volume-speed-row {
    margin-bottom: 6px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Volume Control - Left side, takes up available space */
#volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

/* Speed Control - Right side with dropdown */
#speed-control {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.speed-icon {
    font-size: 14px;
    line-height: 1;
}

#speed-select {
    background-color: #E7E3B5;
    color: #333;
    border: 1px solid #C6C47B;
    padding: 3px 4px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 3px;
    font-family: Arial, sans-serif;
    min-width: 50px;
}

#speed-select:hover {
    background-color: #C6C47B;
}

#speed-select:focus {
    outline: 2px solid #8C1414;
    outline-offset: 1px;
}

#volume-slider {
    flex: 1;
    height: 4px;
    vertical-align: middle;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #8C1414;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #FFF;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    margin-top: -5px;
}

#volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #8C1414;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #FFF;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    margin-top: -5px;
}

#volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #C6C47B;
    border-radius: 2px;
}

#volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #C6C47B;
    border-radius: 2px;
}

#mute-btn {
    background-color: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

#mute-btn:hover {
    opacity: 0.7;
}

/* Mode Controls (Loop & Shuffle) */
#mode-controls {
    margin-bottom: 6px;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.mode-btn {
    background-color: #E7E3B5;
    color: #333;
    border: 1px solid #C6C47B;
    padding: 5px 10px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.mode-btn:hover {
    background-color: #C6C47B;
}

.mode-btn.active {
    background-color: #8C1414;
    color: #FFFFFF;
    border-color: #8C1414;
}

/* Player Status - Right side of controls */
#player-status {
    font-size: 9px;
    color: #666;
    font-style: italic;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 80px;
    text-align: right;
}

/* Queue Display */
#queue-display {
    margin-bottom: 6px;
    padding: 6px;
    background-color: #f9f9f9;
    border: 1px solid #C6C47B;
    border-radius: 3px;
    text-align: left;
    overflow: visible;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.queue-header {
    font-size: 10px;
    font-weight: bold;
    color: #8C1414;
    margin-bottom: 4px;
    text-align: center;
}

#queue-list {
    font-size: 12px;
    color: #555;
    overflow: visible;
    font-family: arial, helvetica, sans-serif;
}

.queue-items {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: visible;
}

.queue-items li {
    padding: 4px 4px;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    background-color: #FFFFFF;
}

.queue-items li:nth-child(odd) {
    background-color: #F5F2D5;
}

.queue-items li:last-child {
    border-bottom: none;
}

/* Lesson Info Panel */
#lesson-info {
    padding: 6px;
    background-color: #E7E3B5;
    border: 1px solid #C6C47B;
    border-radius: 3px;
    text-align: left;
}

.info-header {
    font-size: 10px;
    font-weight: bold;
    color: #8C1414;
    margin-bottom: 4px;
    text-align: center;
}

#lesson-details {
    font-size: 9px;
    color: #555;
    margin-bottom: 6px;
}

#lesson-details div {
    padding: 1px 0;
}

#store-link {
    display: block;
    text-decoration: none;
}

#buy-btn {
    width: 100%;
    background-color: #8C1414;
    color: #FFFFFF;
    border: none;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s;
}

#buy-btn:hover {
    background-color: #6B0F0F;
}

#buy-btn:active {
    background-color: #4A0A0A;
}

/* Mobile responsiveness */
@media screen and (max-width: 480px) {
    #eikaiwa-radio-player {
        padding: 8px;
        max-width: 100%;
    }

    #track-title {
        font-size: 12px;
    }

    #player-controls button {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 35px;
    }

    #play-btn,
    #pause-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    #speed-select {
        min-width: 45px;
        font-size: 9px;
    }

    #volume-speed-row {
        gap: 6px;
    }

    .speed-icon {
        font-size: 12px;
    }
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* Disabled state for buttons */
button:disabled {
    background-color: #CCC !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Compact inline buy button for track listings */
.buy-btn-inline,
.buy-btn-inline:link,
.buy-btn-inline:visited {
    background-color: #8C1414;
    color: #FFFFFF !important;
    border: none;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 15%;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
}

.buy-btn-inline:hover {
    background-color: #6B0F0F;
    color: #FFFFFF !important;
}

.buy-btn-inline:active {
    background-color: #4A0A0A;
}

/* Now Playing buy button - right aligned */
#now-playing {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#now-playing-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#now-playing .buy-btn-inline {
    flex-shrink: 0;
    margin-left: 8px;
}

/* Queue items with buy button */
.queue-items li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: visible;
}

.queue-items li .track-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    cursor: pointer;
    padding: 2px 0;
}

/* Track visible text */
.track-visible {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Track title tooltip */
.track-tooltip-text {
    display: none;
    background-color: #333;
    color: #fff !important;
    text-align: left;
    padding: 6px 10px;
    border-radius: 4px;
    position: absolute;
    z-index: 9999;
    bottom: calc(100% + 2px);
    left: 0;
    font-size: 11px;
    white-space: normal;
    max-width: 280px;
    min-width: 200px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    pointer-events: none;
}

.track-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 15px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.track-tooltip-trigger:hover .track-tooltip-text,
.track-tooltip-trigger.tooltip-active .track-tooltip-text {
    display: block;
}

.queue-items li .buy-btn-inline {
    flex-shrink: 0;
    overflow: visible;
}

/* Custom tooltip that auto-hides */
.buy-btn-inline .tooltip-text {
    visibility: hidden;
    opacity: 0;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 4px 8px;
    border-radius: 3px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.buy-btn-inline .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    border-width: 4px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.buy-btn-inline:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}
