/* Ancient Indian Classical Dance Theme with Enhanced RAG UI Elements */
:root {
    --primary-bg: #fdf6e3;
    --secondary-bg: #dcc7a8;
    --brown: #8b4513;
    --gold: #d4af37;
    --dark-gold: #b8941f;
    --text-dark: #3a2a1a;
    --text-light: #6b5b4a;
    --success-green: #4caf50;
    --error-red: #f44336;
    --warning-orange: #ff9800;
    --shadow-light: rgba(139, 69, 19, 0.1);
    --shadow-medium: rgba(139, 69, 19, 0.2);
    --shadow-heavy: rgba(139, 69, 19, 0.3);
}

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

body {
    font-family: 'Cormorant Garamond', serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.gradio-container {
    min-height: 100vh;
    padding: 20px;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-medium);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Title Section */
.title-section {
    text-align: center;
    padding: 60px 40px 40px;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    border-bottom: 3px solid var(--gold);
    position: relative;
}

.title-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="lotus" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="2" fill="%23d4af37" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23lotus)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.main-title {
    font-family: 'Cinzel', serif;
    font-size: 3.2em;
    font-weight: 700;
    color: var(--brown);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px var(--shadow-light);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-style: italic;
    font-size: 1.3em;
    color: var(--text-light);
    font-weight: 400;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Content Sections */
.content-section {
    padding: 40px;
    animation: fadeInUp 0.8s ease-out;
    position: relative;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 30px;
    text-align: center;
}

.section-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.2em;
    color: var(--brown);
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold) 0%, var(--dark-gold) 100%);
    border-radius: 2px;
}

/* Enhanced Control Panel for RAG System */
.control-panel {
    text-align: center;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(184, 148, 31, 0.05) 100%);
    border-radius: 15px;
    margin: 20px 40px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.control-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

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

.status-box {
    margin-top: 20px;
    padding: 15px 25px;
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid var(--success-green);
    border-radius: 10px;
    display: inline-block;
    min-width: 300px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.status-box.error {
    background: rgba(244, 67, 54, 0.1);
    border-color: var(--error-red);
}

.status-box.warning {
    background: rgba(255, 152, 0, 0.1);
    border-color: var(--warning-orange);
}

#init-status {
    font-weight: 500;
    color: var(--success-green);
    transition: color 0.3s ease;
}

/* Enhanced Buttons with ML Processing States */
.btn {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1em;
    font-weight: 600;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    z-index: -1;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--dark-gold) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--brown) 0%, #a0522d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
}

.btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0) scale(1.02);
}

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

/* Enhanced Audio Container with Recording States */
.audio-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-container {
    border: 3px dashed var(--gold);
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(212, 175, 55, 0.05);
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--gold), var(--dark-gold), var(--gold));
    border-radius: 15px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-container:hover {
    border-color: var(--dark-gold);
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

.upload-container:hover::before {
    opacity: 0.1;
}

.upload-container.drag-over {
    border-color: var(--dark-gold);
    background: rgba(212, 175, 55, 0.15);
    transform: scale(1.02);
}

.upload-container i {
    font-size: 3em;
    color: var(--gold);
    margin-bottom: 15px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.upload-container p {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.file-info {
    font-size: 0.9em;
    color: var(--text-light);
    font-style: italic;
}

.audio-controls {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Recording State Styles */
.recording {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { 
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
        transform: scale(1);
    }
    to { 
        box-shadow: 0 8px 25px rgba(231, 76, 60, 0.6);
        transform: scale(1.02);
    }
}

/* Enhanced Story Content with ML Processing Indicators */
.story-content {
    max-width: 1200px;
    margin: 0 auto;
}

.story-section {
    margin-bottom: 40px;
    background: linear-gradient(135deg, rgba(253, 246, 227, 0.6) 0%, rgba(220, 199, 168, 0.3) 100%);
    border-radius: 15px;
    padding: 30px;
    border-left: 5px solid var(--gold);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.story-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M25,25 Q50,5 75,25 Q50,45 25,25" fill="none" stroke="%23d4af37" stroke-width="0.5" opacity="0.1"/></svg>') repeat;
    pointer-events: none;
    z-index: 0;
}

.story-section > * {
    position: relative;
    z-index: 1;
}

.story-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5em;
    color: var(--brown);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-wrap;
}

.story-text.processing {
    opacity: 0.7;
    position: relative;
}

.story-text.processing::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gold);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.shloka-details {
    border-left: 5px solid var(--gold);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(184, 148, 31, 0.05) 100%);
}

/* Enhanced Gallery with AI-Generated Content */
.gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-column h4 {
    font-family: 'Cinzel', serif;
    color: var(--brown);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mudra-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    min-height: 200px;
    background: linear-gradient(135deg, rgba(253, 246, 227, 0.4) 0%, rgba(220, 199, 168, 0.2) 100%);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.mudra-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-light);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mudra-gallery img:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 8px 25px var(--shadow-medium);
    border-color: var(--gold);
}

.ensemble-container {
    position: relative;
    min-height: 300px;
    background: linear-gradient(135deg, rgba(253, 246, 227, 0.4) 0%, rgba(220, 199, 168, 0.2) 100%);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.3);
    overflow: hidden;
}

.ensemble-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 6px 20px var(--shadow-medium);
    transition: transform 0.3s ease;
}

.ensemble-image:hover {
    transform: scale(1.02);
}

.ensemble-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
}

.ensemble-placeholder i {
    font-size: 3em;
    margin-bottom: 10px;
    display: block;
    opacity: 0.5;
}

/* Enhanced Instructions with RAG System Details */
.instructions {
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.08) 0%, rgba(139, 69, 19, 0.03) 100%);
    border-radius: 15px;
    padding: 30px;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.instructions ol {
    list-style: none;
    counter-reset: step-counter;
}

.instructions li {
    counter-increment: step-counter;
    margin-bottom: 25px;
    padding-left: 60px;
    position: relative;
    font-size: 1.1em;
    line-height: 1.7;
}

.instructions li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--gold) 0%, var(--dark-gold) 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Cinzel', serif;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* Loading and Processing States */
.btn.loading {
    opacity: 0.8;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Divider */
.divider {
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--gold) 20%, var(--dark-gold) 50%, var(--gold) 80%, transparent 100%);
    margin: 40px 0;
    position: relative;
    overflow: hidden;
}

.divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced Footer */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
    font-style: italic;
    background: linear-gradient(135deg, rgba(253, 246, 227, 0.3) 0%, rgba(220, 199, 168, 0.1) 100%);
}

.footer p {
    margin: 5px 0;
}

.footer small {
    font-size: 0.85em;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 968px) {
    .gallery {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.2em;
        letter-spacing: 1px;
    }
    
    .subtitle {
        font-size: 1.1em;
    }
    
    .content-section {
        padding: 20px;
    }
    
    .section-header h2 {
        font-size: 1.8em;
    }
    
    .btn {
        font-size: 1em;
        padding: 12px 25px;
        margin: 3px;
    }
    
    .upload-container {
        padding: 30px 15px;
    }
    
    .instructions li {
        padding-left: 50px;
        font-size: 1em;
    }
    
    .instructions li::before {
        width: 35px;
        height: 35px;
    }
    
    .audio-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .main-container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .title-section {
        padding: 40px 20px 30px;
    }
    
    .main-title {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .content-section {
        padding: 15px;
    }
    
    .control-panel {
        margin: 15px 20px;
    }
    
    .story-section h3 {
        font-size: 1.3em;
        flex-direction: column;
        gap: 5px;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: var(--dark-gold);
        border: 2px solid var(--text-dark);
    }
    
    .btn-secondary {
        background: var(--brown);
        border: 2px solid var(--text-dark);
    }
    
    .story-section {
        border: 2px solid var(--gold);
    }
}
