/**
 * RadioRobot - Custom Styles
 */

/* Layout */
html, body {
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Cards */
.track-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.track-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Track covers - quadrate */
.track-cover-square {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.375rem 0 0 0.375rem;
}

.track-cover-placeholder-square {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.375rem 0 0 0.375rem;
}

.track-cover-container {
    position: relative;
}

.track-cover-container .regenerate-cover-btn {
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
}

.track-cover-container:hover .regenerate-cover-btn {
    opacity: 1;
}

/* Audio player */
audio {
    border-radius: 8px;
}

/* Lyrics preview */
.lyrics-preview {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--bs-tertiary-bg);
    padding: 10px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Progress bar animation */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* Form styling */
textarea.form-control {
    font-family: monospace;
}

/* Navbar brand */
.navbar-brand i {
    color: #ffc107;
}

/* Badge styling */
.badge {
    font-weight: 500;
}

/* Button spacing in cards */
.track-card .btn-sm {
    font-size: 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .track-card .d-flex.gap-2 {
        flex-direction: column;
    }

    .track-card .btn-sm {
        width: 100%;
    }
}

/* Details/summary styling */
details summary {
    cursor: pointer;
    user-select: none;
}

details summary:hover {
    text-decoration: underline;
}

/* Alert improvements */
.alert i {
    margin-right: 0.5rem;
}

/* Card header icons */
.card-header i {
    margin-right: 0.5rem;
}

/* Generation form */
#generate-form .form-text {
    font-size: 0.8rem;
}

/* Parameter help icons */
.param-help {
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.param-help:hover {
    opacity: 1;
}

/* Progress section */
#progress-section .progress {
    background-color: var(--bs-secondary-bg);
}

#progress-section .progress-bar {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Result section audio */
#result-section audio {
    background-color: var(--bs-tertiary-bg);
    padding: 5px;
}

/* Loading state */
.btn:disabled {
    cursor: not-allowed;
}

/* Truncate utility */
.text-truncate {
    max-width: 100%;
}

/* Editable title */
.editable-title {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.2s;
}

.editable-title:hover {
    border-bottom-color: #6c757d;
}

.edit-title-btn {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.edit-title-btn:hover {
    opacity: 1;
}

/* Suggestion card */
.bg-body-tertiary.card ul {
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
}

.bg-body-tertiary.card code {
    background-color: var(--bs-secondary-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Prontuario scrollabile */
.prontuario-scroll {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 10px;
    font-size: 0.85rem;
}

.prontuario-scroll::-webkit-scrollbar {
    width: 6px;
}

.prontuario-scroll::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.prontuario-scroll::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-bg);
    border-radius: 3px;
}

.prontuario-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--bs-border-color);
}

.prontuario-scroll h6 {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    padding: 5px 0;
    margin-top: 0;
    z-index: 1;
}

.prontuario-scroll hr {
    margin: 0.75rem 0;
}

.prontuario-scroll table {
    font-size: 0.8rem;
}

.prontuario-scroll table code {
    font-size: 0.75rem;
}

/* Clickable tags in guide */
.tag-lyrics, .tag-style {
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
}

.tag-lyrics:hover, .tag-style:hover {
    transform: scale(1.05);
}

/* Badge colors - ensure good contrast with white text */
.prontuario-scroll .badge.bg-info {
    background-color: #0a7c9e !important; /* darker cyan */
}

.prontuario-scroll .badge.bg-success {
    background-color: #157347 !important; /* darker green */
}

.prontuario-scroll .badge.bg-warning {
    background-color: #997404 !important; /* darker yellow/gold */
    color: #fff !important;
}

.prontuario-scroll .badge.bg-danger {
    background-color: #a52834 !important; /* darker red */
}

.prontuario-scroll .badge.bg-primary {
    background-color: #0a58ca !important; /* slightly darker blue */
}

.prontuario-scroll .badge.bg-secondary {
    background-color: #495057 !important; /* darker gray */
}

.preset-btn {
    text-align: left;
}

/* === PUBLIC TRACKS GRID (Homepage) === */
.public-track-box {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.public-track-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.public-track-box.playing {
    box-shadow: 0 0 0 3px #0d6efd, 0 8px 20px rgba(13, 110, 253, 0.3);
}

.public-track-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #1a1a2e;
}

.public-track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.public-track-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #4a5568;
    font-size: 2.5rem;
}

.public-track-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    opacity: 1;
    transition: opacity 0.2s;
}

.public-track-info {
    color: white;
}

.public-track-title {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.public-track-meta {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    display: flex;
    gap: 8px;
}

.public-track-meta i {
    margin-right: 2px;
}

.public-track-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 3rem;
    color: rgba(255,255,255,0.9);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.public-track-box:hover .public-track-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.public-track-box.playing .public-track-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.public-track-box.playing .public-track-play i::before {
    content: "\F4C3"; /* bi-pause-circle-fill */
}

/* Now Playing Bar */
#now-playing-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 12px 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 1000;
}

.now-playing-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.now-playing-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
    max-width: 200px;
}

.now-playing-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-author {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.now-playing-time-current,
.now-playing-time-total {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
    min-width: 35px;
    text-align: center;
}

.now-playing-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.now-playing-progress-fill {
    height: 100%;
    background: #0d6efd;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.now-playing-progress-bar:hover .now-playing-progress-fill {
    background: #3d8bfd;
}

.now-playing-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.now-playing-volume {
    display: flex;
    align-items: center;
    gap: 6px;
}

.now-playing-volume i {
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.9;
}

.now-playing-volume i:hover {
    opacity: 1;
}

#volume-slider {
    width: 80px;
    height: 4px;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    background: white;
}

#volume-slider::-moz-range-thumb {
    background: white;
}

/* Responsive */
@media (max-width: 576px) {
    .public-track-title {
        font-size: 0.75rem;
    }

    .public-track-meta {
        font-size: 0.65rem;
    }

    .public-track-play {
        font-size: 2rem;
    }

    /* Now Playing Bar responsive */
    .now-playing-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .now-playing-info {
        min-width: 100px;
        max-width: 140px;
    }

    .now-playing-progress {
        order: 3;
        width: 100%;
        flex-basis: 100%;
    }

    .now-playing-volume {
        display: none;
    }

    .now-playing-title {
        font-size: 0.85rem;
    }

    .now-playing-author {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    #volume-slider {
        width: 60px;
    }

    .now-playing-info {
        max-width: 160px;
    }
}
