/* Namespaced CSS to avoid theme conflicts */
.podhaus-upload-shell {
    min-height: calc(100vh - 190px);
}

.podhaus-upload-shell .col-lg-8 {
    max-width: 880px;
}

.podhaus-logo-lockup img {
    max-width: min(280px, 80vw);
    height: auto;
}

.podhaus-upload-card,
.podhaus-results-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.podhaus-upload-card > .card-body {
    padding: 2rem;
}

.podhaus-dropzone {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color) !important;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.podhaus-dropzone:hover,
.podhaus-dropzone.dragover {
    background: rgba(124, 58, 237, 0.06);
    border-color: #7c3aed !important;
}

.podhaus-progress-state .progress {
    height: 1.25rem;
    border-radius: 999px;
}

.podhaus-progress-state .progress-bar {
    min-width: 2.5rem;
}

#emailRequirement {
    border-radius: 8px;
    background: var(--bs-tertiary-bg);
}

.podhaus-viewer-shell {
    min-height: calc(100vh - 190px);
}

.podhaus-viewer-hero {
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: stretch;
    padding: 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--bs-body-bg), var(--bs-tertiary-bg));
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.podhaus-viewer-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.podhaus-viewer-brand img {
    max-width: min(220px, 42vw);
    height: auto;
}

.podhaus-viewer-audio-panel {
    width: min(520px, 100%);
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-body-bg);
}

.podhaus-viewer-audio-panel audio {
    width: 100%;
}

.podhaus-viewer-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.podhaus-viewer-actions .btn {
    min-height: 44px;
    white-space: nowrap;
}

.podhaus-viewer-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.podhaus-viewer-card .card-header {
    padding: 1.35rem 1.5rem;
    border-bottom-color: var(--bs-border-color);
}

.podhaus-viewer-entries {
    display: grid;
    gap: 0;
}

.podhaus-viewer-entry {
    position: relative;
    display: grid;
    grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
    gap: 1rem;
    padding: 1.15rem 1.5rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.podhaus-viewer-entry:first-child {
    border-top: 0;
}

.podhaus-viewer-entry::before {
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    left: 0;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: transparent;
    content: "";
}

.podhaus-viewer-entry.is-active {
    background: rgba(124, 58, 237, 0.07);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.22);
}

.podhaus-viewer-entry.is-active::before {
    background: #7c3aed;
}

.podhaus-segment-meta {
    display: grid;
    gap: 0.5rem;
    align-self: start;
}

.podhaus-segment-number {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.podhaus-timestamp {
    align-self: start;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    padding: 0.625rem 0.75rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.podhaus-timestamp:hover,
.podhaus-timestamp:focus,
.podhaus-viewer-entry.is-active .podhaus-timestamp {
    background: rgba(124, 58, 237, 0.06);
    border-color: #7c3aed;
    outline: none;
}

.podhaus-segment-text {
    min-height: 5.75rem;
    resize: vertical;
    line-height: 1.5;
    border-color: #d6dce5;
    background: rgba(255, 255, 255, 0.92);
}

.podhaus-segment-text:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.12);
}

.podhaus-transcript-editor .transcript-textarea {
    min-height: 18rem;
    max-height: 55vh;
    font-family: "Courier New", monospace;
    line-height: 1.5;
    resize: vertical;
}

.podhaus-transcript-editor .editor-actions {
    align-items: center;
}

.podhaus-transcript-editor .editor-actions .btn,
#resultsSection .btn {
    min-height: 44px;
    white-space: nowrap;
}

[data-bs-theme="dark"] .podhaus-upload-card,
[data-bs-theme="dark"] .podhaus-results-card,
[data-bs-theme="dark"] .podhaus-viewer-card {
    background: var(--bs-body-bg);
    box-shadow: none;
}

[data-bs-theme="dark"] .podhaus-dropzone,
[data-bs-theme="dark"] #emailRequirement {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .podhaus-results-card .card-header {
    background: var(--bs-tertiary-bg);
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .podhaus-viewer-card .card-header {
    background: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .podhaus-viewer-hero,
[data-bs-theme="dark"] .podhaus-viewer-audio-panel {
    background: var(--bs-body-bg);
    box-shadow: none;
}

[data-bs-theme="dark"] .podhaus-segment-text {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

@media (max-width: 576px) {
    main.container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .podhaus-upload-card > .card-body {
        padding: 1.25rem;
    }

    .podhaus-dropzone {
        padding: 1.5rem 1rem !important;
    }

    .podhaus-transcript-editor .transcript-textarea {
        min-height: 16rem;
    }

    .podhaus-transcript-editor .editor-actions .btn,
    #resultsSection .btn,
    #submitBtn {
        width: 100%;
    }

    .podhaus-viewer-hero,
    .podhaus-viewer-brand {
        flex-direction: column;
        align-items: stretch;
    }

    .podhaus-viewer-brand {
        text-align: center;
    }

    .podhaus-viewer-brand img {
        max-width: min(240px, 80vw);
    }

    .podhaus-viewer-actions,
    .podhaus-viewer-card .btn {
        width: 100%;
    }

    .podhaus-viewer-actions .btn {
        width: 100%;
    }

    .podhaus-viewer-card .card-header {
        padding: 1rem;
    }

    .podhaus-viewer-entry {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }

    #newTranscription {
        margin-left: 0 !important;
    }
}

.transcriber-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.transcriber-container .header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.transcriber-container .logo-container {
    display: flex;
    align-items: center;
}

.transcriber-container .podhaus-logo {
    height: 50px;
    width: auto;
}

.transcriber-container .header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transcriber-container .theme-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.transcriber-container .theme-toggle:hover {
    background: #f1f5f9;
    color: #7c3aed;
}

.transcriber-container .transcriber-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 40px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.transcriber-container .upload-section {
    margin-bottom: 30px;
}

.transcriber-container .form-group {
    margin-bottom: 25px;
}

.transcriber-container .form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.transcriber-container .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s ease;
}

.transcriber-container .form-select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.transcriber-container .file-upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.transcriber-container .file-upload-area:hover {
    border-color: #7c3aed;
    background: #f8faff;
}

.transcriber-container .file-upload-area.dragover {
    border-color: #7c3aed;
    background: #f0f4ff;
    transform: scale(1.02);
}

.transcriber-container .upload-icon {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.transcriber-container .upload-text h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.transcriber-container .upload-text p {
    color: #6b7280;
    font-size: 14px;
    margin: 5px 0;
}

.transcriber-container .file-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.transcriber-container .selected-file {
    display: flex;
    align-items: center;
    gap: 10px;
}

.transcriber-container .selected-file i {
    color: #0ea5e9;
    font-size: 18px;
}

.transcriber-container .transcribe-section {
    text-align: center;
    margin: 30px 0;
}

.transcriber-container .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.transcriber-container .btn-primary {
    background: #7c3aed;
    color: white;
}

.transcriber-container .btn-primary:hover {
    background: #6d28d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.transcriber-container .btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.transcriber-container .btn-success {
    background: #10b981;
    color: white;
}

.transcriber-container .btn-success:hover {
    background: #059669;
}

.transcriber-container .btn-secondary {
    background: #6b7280;
    color: white;
}

.transcriber-container .btn-secondary:hover {
    background: #4b5563;
}

.transcriber-container .btn-outline-primary {
    background: transparent;
    color: #7c3aed;
    border: 2px solid #7c3aed;
}

.transcriber-container .btn-outline-primary:hover {
    background: #7c3aed;
    color: white;
}

.transcriber-container .progress-section {
    margin: 30px 0;
    text-align: center;
}

.transcriber-container .progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.transcriber-container .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.transcriber-container .progress-text {
    font-weight: 600;
    color: #374151;
}

.transcriber-container .results-section {
    margin: 30px 0;
}

.transcriber-container .results-section h3 {
    color: #10b981;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.transcriber-container .download-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.transcriber-container .download-btn {
    background: #3b82f6;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.transcriber-container .download-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    text-decoration: none;
    color: white;
}

.transcriber-container .transcript-editor {
    margin: 25px 0;
}

.transcriber-container .transcript-editor label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.transcriber-container .transcript-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.transcriber-container .transcript-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.transcriber-container .editor-controls {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    justify-content: flex-start;
}

.transcriber-container .error-section {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.transcriber-container .error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #dc2626;
    font-weight: 600;
    margin-bottom: 15px;
}

.transcriber-container .error-message i {
    font-size: 18px;
}

/* ===== DARK MODE ===== */

/* The main card has hardcoded white bg — override it for dark mode */
[data-bs-theme="dark"] .transcriber-container {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .transcriber-container .header-section {
    border-bottom-color: var(--bs-border-color);
}

/* Brand purple button — Bootstrap dark mode overrides to blue, force it back */
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: #7c3aed;
    --bs-btn-border-color: #7c3aed;
    --bs-btn-hover-bg: #6d28d9;
    --bs-btn-hover-border-color: #6d28d9;
    --bs-btn-active-bg: #5b21b6;
    --bs-btn-active-border-color: #5b21b6;
    --bs-btn-disabled-bg: #4c1d95;
    --bs-btn-disabled-border-color: #4c1d95;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .transcriber-container {
        padding: 20px;
        margin: 10px;
    }

    .transcriber-container .transcriber-title {
        font-size: 2rem;
    }

    .transcriber-container .download-links {
        flex-direction: column;
        align-items: center;
    }

    .transcriber-container .editor-controls {
        flex-direction: column;
    }
}
