/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

.api-status-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.tab-button {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: #666;
}

.tab-button:hover {
    background: rgba(102, 126, 234, 0.1);
}

.tab-button.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* Tab content */
.tab-content {
    display: none;
    padding: 30px;
    min-height: 400px;
}

.tab-content.active {
    display: block;
}

/* Forms */
.form-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 500;
    min-width: 180px;
}

input[type="date"] {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #667eea;
}

/* Results */
.results {
    margin-top: 20px;
}

.celebration {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.celebration-header {
    border-bottom: 2px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.celebration-title {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 10px;
}

.liturgical-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.info-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
}

.info-item strong {
    color: #667eea;
}

.notices {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px;
    margin: 15px 0;
}

.block {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.block-title {
    font-size: 1.3rem;
    color: #764ba2;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.part {
    margin-bottom: 20px;
}

.part-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.option {
    background: #f5f5f5;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-bottom: 10px;
}

.option-text {
    margin-bottom: 10px;
}

.text-la {
    font-style: italic;
    color: #666;
}

.text-pt {
    font-weight: 500;
}

.music-section {
    margin-top: 15px;
}

.music-section h4 {
    font-size: 0.95rem;
    color: #667eea;
    margin-bottom: 8px;
}

.music-list {
    list-style: none;
}

.music-item {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.music-item.has-thumbnail {
    padding: 8px;
}

.music-thumbnail {
    flex-shrink: 0;
    width: 120px;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.music-thumbnail a {
    display: block;
    position: relative;
}

.music-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s;
}

.music-thumbnail:hover img {
    opacity: 0.8;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    pointer-events: none;
}

.music-info {
    flex: 1;
    min-width: 0;
}

.music-title {
    font-weight: 500;
    margin-bottom: 3px;
}

.music-link {
    color: #667eea;
    text-decoration: none;
}

.music-link:hover {
    text-decoration: underline;
}

.music-channel {
    font-size: 0.85rem;
    color: #666;
}

.music-notes {
    margin-top: 4px;
    color: #999;
}

.music-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.pastoral-summary {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
}

.pastoral-summary h3 {
    color: #2e7d32;
    margin-bottom: 10px;
}

/* Channels section */
.channels-section {
    max-width: 800px;
    margin: 0 auto;
}

.channels-group {
    margin-bottom: 30px;
}

.channels-group h3 {
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.channel-list {
    list-style: none;
}

.channel-item {
    background: #f5f5f5;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.channel-name {
    font-weight: 500;
}

/* Voting Styles */
.voting-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.music-voting {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-right: 10px;
}

.vote-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.vote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.vote-btn.vote-up:hover {
    border-color: #27ae60;
    background: #e8f5e9;
}

.vote-btn.vote-down:hover {
    border-color: #e74c3c;
    background: #ffebee;
}

.vote-count {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.vote-score {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 4px 12px;
    border-radius: 6px;
    background: #f0f0f0;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.vote-score.positive {
    background: #d4edda;
    color: #27ae60;
}

.vote-score.negative {
    background: #f8d7da;
    color: #e74c3c;
}

.music-item.winner {
    background: linear-gradient(to right, #fff9e6, white);
    border-left: 4px solid #f39c12;
}

.winner-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.95rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-error {
    background: #b42318;
}

/* Footer */
footer {
    background: #f5f5f5;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .form-group {
        flex-direction: column;
        align-items: stretch;
    }

    .form-group label {
        min-width: auto;
    }

    .liturgical-info {
        grid-template-columns: 1fr;
    }

    .music-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .music-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .music-voting {
        width: 100%;
        justify-content: center;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .toast {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .container {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }

    header {
        padding: 24px 18px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .tab-content {
        padding: 24px 18px;
    }

    .tab-button {
        min-height: 52px;
        padding: 12px 8px;
        font-size: 0.95rem;
    }
}
