/* ============================================
   BioSonification - Main Stylesheet
   Modern, clean design with dark theme
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #1e2a4a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: #2d3748;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    animation: pulse 3s ease-in-out infinite;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.nav-btn {
    padding: 12px 24px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.nav-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Page Content */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* About Section */
.about-section {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h3 {
    color: var(--accent-primary);
    margin-top: 32px;
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.about-content ul,
.about-content ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 24px;
}

.about-content li {
    margin-bottom: 8px;
}

.about-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Textarea */
textarea {
    width: 100%;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* Info Text */
.info-text {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.info-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.file-upload-area p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.or-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-name {
    margin-top: 12px;
    color: var(--accent-primary);
    font-weight: 500;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
    width: 100%;
    margin-top: 24px;
}

/* Loading Section */
.loading-section {
    text-align: center;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-section h3 {
    color: var(--text-primary);
}

.loading-section p {
    color: var(--text-secondary);
}

/* Error Section */
.error-section {
    text-align: center;
    border-color: var(--error);
}

.error-icon {
    width: 64px;
    height: 64px;
    color: var(--error);
    margin-bottom: 16px;
}

.error-section h3 {
    color: var(--error);
}

.error-section p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Results Section */
.success-icon {
    width: 32px;
    height: 32px;
    color: var(--success);
}

/* Audio Player */
.audio-player-section {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

#audio-player {
    width: 100%;
    height: 48px;
}

.audio-unavailable {
    text-align: center;
    padding: 24px;
}

.warning-icon {
    width: 48px;
    height: 48px;
    color: var(--warning);
    margin: 0 auto 16px;
}

.audio-unavailable p {
    color: var(--text-secondary);
}

.install-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Download Button */
#download-midi-btn {
    display: flex;
    margin: 24px 0;
}

/* Params Grid */
.params-section {
    margin: 32px 0;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.param-card {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}

.param-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
}

.param-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    color: var(--accent-primary);
}

.param-icon svg {
    width: 100%;
    height: 100%;
}

.param-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.param-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Sequence Info */
.sequence-info {
    margin: 24px 0;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.sequence-info p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sequence-info strong {
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.footer p {
    color: var(--text-muted);
    margin-bottom: 8px;
}

.disclaimer {
    font-size: 0.875rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .logo-icon {
        width: 48px;
        height: 48px;
    }

    .card {
        padding: 24px;
    }

    .params-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-large {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .params-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }
}

/* ============================================
   Examples Gallery Section
   ============================================ */

.examples-section {
    margin-bottom: 48px;
}

.examples-section h2 {
    text-align: center;
    margin-bottom: 12px;
}

.section-description {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 1rem;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.loading-examples {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
}

.loading-examples .spinner {
    margin: 0 auto 16px;
}

.loading-examples p {
    color: var(--text-secondary);
}

/* Example Card */
.example-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.example-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-primary);
}

.example-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.organism-icon {
    font-size: 2rem;
    line-height: 1;
}

.organism-info {
    flex: 1;
}

.organism-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.scientific-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

.example-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Audio Player */
.example-audio-player {
    margin-bottom: 16px;
}

.example-audio-player audio {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.example-audio-player audio::-webkit-media-controls-panel {
    background: var(--bg-input);
}

.example-audio-player audio::-webkit-media-controls-play-button,
.example-audio-player audio::-webkit-media-controls-current-time-display,
.example-audio-player audio::-webkit-media-controls-time-remaining-display {
    color: var(--text-primary);
}

/* Example Metadata */
.example-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.metadata-icon {
    font-size: 1rem;
}

/* Example Actions */
.example-actions {
    margin-top: auto;
}

.example-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.example-download-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.example-download-btn svg {
    width: 16px;
    height: 16px;
}

/* Audio Unavailable Message */
.audio-unavailable-example {
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    text-align: center;
}

.audio-unavailable-example p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* Responsive for Examples */
@media (max-width: 768px) {
    .examples-grid {
        grid-template-columns: 1fr;
    }

    .example-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .example-metadata {
        flex-direction: column;
        gap: 8px;
    }
}
