/* Audio RAG Web App Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    margin-bottom: 30px;
    color: white;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    text-align: left;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-org {
    font-size: 0.85rem;
    opacity: 0.8;
}

.admin-badge {
    background: #ffd700;
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-left {
        text-align: center;
    }
    
    .header h1 {
        font-size: 2rem;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Available Episodes Section */
.available-episodes {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 4px solid #28a745;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.available-episodes h3 {
    color: #28a745;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
}

.available-episodes p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.episode-list-box {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.episode-item {
    padding: 8px 0;
    font-size: 0.95rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.episode-item:last-child {
    border-bottom: none;
}

.episode-item:hover {
    background: #f8f9fa;
    padding-left: 8px;
    color: #28a745;
}

/* Show Selection Section */
.show-selection-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.show-selection-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.show-selection-section p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.show-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.show-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.show-checkbox:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.show-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.show-checkbox input[type="checkbox"]:checked + label {
    color: #667eea;
    font-weight: 600;
}

.show-checkbox.checked {
    background: #e3f2fd;
    border-color: #667eea;
    color: #0d47a1;
}

.show-checkbox.checked label {
    color: #0d47a1;
    font-weight: 600;
}

.show-checkbox label {
    cursor: pointer;
    font-size: 0.9em;
    margin: 0;
}

.select-all-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.select-all-btn:hover {
    background: #218838;
}

.clear-all-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.clear-all-btn:hover {
    background: #c82333;
}

/* Query Section */
.query-section {
    margin-bottom: 30px;
}

.query-form {
    width: 100%;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#queryInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#queryInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#submitBtn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#submitBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Section */
.results-section {
    display: grid;
    gap: 25px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.result-card h2 {
    color: #667eea;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

/* Result Header */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.result-metadata {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Exact Match Indicator */
.exact-match-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #d4edda;
    color: #155724;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #c3e6cb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.exact-match-indicator i {
    color: #28a745;
    font-size: 0.9rem;
}

/* Episode Title */
.episode-title {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e3f2fd;
    color: #0d47a1;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #bbdefb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.episode-title i {
    color: #1976d2;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Answer Content */
.answer-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Audio Player */
.audio-player-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

#audioPlayer {
    width: 100%;
    margin-bottom: 15px;
}

.audio-info {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

/* Multiple Audio Players */
.audio-clip {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.audio-clip:last-child {
    margin-bottom: 0;
}

.audio-clip-info {
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 10px;
    font-weight: 500;
}

.audio-clip audio {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Script Content */
.script-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Section Info */
.section-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-label {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.info-value {
    color: #333;
    font-size: 1rem;
}

/* Error Section */
.error-section {
    margin-top: 20px;
}

.error-card {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 12px;
    padding: 25px;
    border-left: 4px solid #dc3545;
}

.error-card h2 {
    color: #721c24;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    color: #721c24;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #submitBtn {
        justify-content: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .episode-list-box {
        max-height: 150px;
    }
    
    .episode-item {
        font-size: 0.9rem;
        padding: 6px 0;
    }
    
    .result-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-metadata {
        align-items: stretch;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .exact-match-indicator,
    .episode-title {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .episode-title {
        max-width: none;
        flex: 1;
        margin-left: 8px;
    }
}

/* Scrollbar Styling */
.script-content::-webkit-scrollbar,
.episode-list-box::-webkit-scrollbar {
    width: 8px;
}

.script-content::-webkit-scrollbar-track,
.episode-list-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.script-content::-webkit-scrollbar-thumb,
.episode-list-box::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.script-content::-webkit-scrollbar-thumb:hover,
.episode-list-box::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* Feedback Widget Styles */
.feedback-widget {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.feedback-question {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
    color: #495057;
}

.feedback-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.feedback-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-yes {
    background: #28a745;
    color: white;
}

.feedback-yes:hover {
    background: #218838;
    transform: translateY(-1px);
}

.feedback-no {
    background: #dc3545;
    color: white;
}

.feedback-no:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.feedback-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-status {
    color: #28a745;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-comment textarea {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.feedback-comment textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Responsive feedback widget */
@media (max-width: 768px) {
    .feedback-buttons {
        flex-direction: column;
    }
    
    .feedback-btn {
        justify-content: center;
    }
}
