* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.75), rgba(44, 62, 80, 0.8)),
                url('https://images.unsplash.com/photo-1507838153414-b4b713384a76?auto=format&fit=crop&w=1200&q=80')
                center/cover no-repeat;
    color: white;
    padding: 3.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 2.2rem;
    margin-bottom: 0.4rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.header-content p {
    font-size: 1.15rem;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Main */
main {
    flex: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 700px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

/* Category titles */
.category-title {
    font-size: 1.15rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
}

.warmup-title {
    background: linear-gradient(135deg, #e67e22, #f39c12);
}

.canciones-title {
    background: linear-gradient(135deg, #2c3e50, #3498db);
}

/* Song List */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.song-item {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.song-item:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.song-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.song-header:hover {
    background: #f7f9fc;
}

.song-header .song-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.song-header .song-number {
    background: #3498db;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.song-header .song-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.song-header .arrow {
    font-size: 1.2rem;
    color: #999;
    transition: transform 0.3s;
}

.song-item.open .song-header .arrow {
    transform: rotate(180deg);
}

/* Voices submenu */
.voices-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: #f7f9fc;
}

.song-item.open .voices-menu {
    max-height: 1200px;
}

.voices-menu ul {
    list-style: none;
    padding: 0.5rem 1.2rem 1rem 1.2rem;
}

.voices-menu li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid #e8ecf1;
}

.voices-menu li:last-child {
    border-bottom: none;
}

/* Voice actions (play + download) */
.voice-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #e67e22;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.play-btn:hover {
    background: #d35400;
    transform: scale(1.08);
}

a.view-btn {
    background: #27ae60;
    text-decoration: none;
    font-size: 1.1rem;
}

a.view-btn:hover {
    background: #219a52;
}

/* Audio player row */
.audio-player-row {
    padding: 0.3rem 0 0.6rem 0;
    border-bottom: 1px solid #e8ecf1;
}

.audio-player-row audio {
    width: 100%;
}

.audio-player-row.hidden {
    display: none;
}

.voice-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.voice-icon {
    font-size: 1.3rem;
}

.voice-name {
    font-weight: 500;
    color: #444;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #3498db;
    color: white;
    padding: 0.45rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

.download-btn:hover {
    background: #2980b9;
    transform: scale(1.03);
}

.download-btn.partitura-btn {
    background: #27ae60;
}

.download-btn.partitura-btn:hover {
    background: #219a52;
}

/* Pista (instrumental) */
.play-btn.pista-btn {
    background: #8e44ad;
}

.play-btn.pista-btn:hover {
    background: #732d91;
}

.download-btn.pista-download-btn {
    background: #8e44ad;
}

.download-btn.pista-download-btn:hover {
    background: #732d91;
}

.download-btn .btn-icon {
    font-size: 1rem;
}

/* Footer */
footer {
    background: #2c3e50;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 0;
    background: #2c3e50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.main-nav a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.main-nav a.active {
    color: white;
    border-bottom: 3px solid #3498db;
    background: rgba(255, 255, 255, 0.05);
}

/* PIN overlay */
.pin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pin-overlay.hidden {
    display: none;
}

.pin-box {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 320px;
    width: 90%;
}

.pin-box h2 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.pin-box p {
    color: #666;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

.pin-input-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.pin-box input {
    width: 180px;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.4rem;
    padding: 0.5rem 2.2rem 0.5rem 0.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.pin-box input:focus {
    border-color: #3498db;
}

.pin-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.pin-toggle:hover {
    opacity: 1;
}

.pin-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.pin-error.hidden {
    display: none;
}

/* Buttons */
.btn {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    transform: scale(1.03);
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-save {
    background: #27ae60;
    color: white;
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    margin-top: 1rem;
    border-radius: 10px;
}

.btn-save:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Asistencia sections */
.asistencia-section {
    margin-bottom: 2rem;
}

/* Add member row */
.add-member-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.add-member-row input[type="text"] {
    flex: 1;
    min-width: 140px;
    padding: 0.6rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

.add-member-row input[type="text"]:focus {
    border-color: #3498db;
}

.add-member-row select {
    padding: 0.6rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: white;
}

.add-member-row select:focus {
    border-color: #3498db;
}

/* Members list */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.voice-group {
    background: white;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.voice-group-title {
    font-size: 0.95rem;
    color: #3498db;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #eee;
}

.member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.voice-select-sm {
    padding: 0.25rem 0.4rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.8rem;
    outline: none;
    background: white;
    cursor: pointer;
}

.voice-select-sm:focus {
    border-color: #3498db;
}

.member-name {
    font-size: 0.95rem;
    color: #333;
}

/* Session row */
.session-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.session-row input[type="date"] {
    padding: 0.6rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

.session-row input[type="date"]:focus {
    border-color: #3498db;
}

.session-date-label {
    font-size: 1.05rem;
    color: #2c3e50;
    margin: 1rem 0 0.5rem;
}

/* Attendance checkboxes */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attendance-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.8rem;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.attendance-row:hover {
    background: #e8f4fd;
}

.attendance-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #27ae60;
    cursor: pointer;
}

.attendance-row span {
    font-size: 0.95rem;
    color: #333;
}

/* History */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-date {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1rem;
}

.history-count {
    background: #3498db;
    color: white;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.history-details {
    font-size: 0.9rem;
    line-height: 1.5;
}

.present-list {
    color: #27ae60;
    margin-bottom: 0.3rem;
}

.absent-list {
    color: #e74c3c;
}

.empty-msg {
    color: #999;
    font-style: italic;
    padding: 0.5rem 0;
}

.total-members {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.8rem;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 500px) {
    .header-content h1 {
        font-size: 1.5rem;
    }

    .song-header {
        padding: 0.8rem 1rem;
    }

    .download-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .add-member-row {
        flex-direction: column;
    }

    .session-row {
        flex-direction: column;
    }
}

/* ============================================================
   Soporte offline (Service Worker) — banner y botón de precarga
   ============================================================ */

.net-status-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0.6rem 1rem;
    background: #f59e0b;
    color: #1f2937;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.95rem;
}

.net-status-banner.hidden {
    display: none;
}

.offline-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin: 0 0 1.2rem;
    padding: 0.8rem 1rem;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    border-radius: 10px;
}

.precache-btn {
    background: #7c3aed;
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}

.precache-btn:hover:not(:disabled) {
    background: #6d28d9;
}

.precache-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.precache-btn:disabled {
    background: #a78bfa;
    cursor: progress;
}

.precache-progress {
    color: #4c1d95;
    font-size: 0.9rem;
    font-weight: 500;
}
