/* --- CSS Design System --- */
:root {
    --bg-dark: #070b13;
    --bg-card: rgba(17, 25, 40, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #00f2fe;
    --primary-hover: #00c6ff;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    
    --accent: #a855f7;
    --accent-hover: #9333ea;
    --accent-gradient: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --shadow-neon: 0 8px 32px 0 rgba(0, 242, 254, 0.15);
    --shadow-accent: 0 8px 32px 0 rgba(168, 85, 247, 0.15);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Glow Effects */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

.bg-glow-1 {
    background: radial-gradient(circle, #00f2fe 0%, transparent 70%);
    top: -200px;
    left: -200px;
}

.bg-glow-2 {
    background: radial-gradient(circle, #a855f7 0%, transparent 70%);
    bottom: -200px;
    right: -200px;
}

/* --- Typography --- */
h1, h2, h3, h4, .logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* --- Layout Utility Classes --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.hidden {
    display: none !important;
}

.mt-4 { margin-top: 1rem; }
.text-primary { color: #00f2fe; }
.text-accent { color: #a855f7; }

/* --- Glassmorphism Card Style --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* --- Auth Screens --- */
#auth-screen, #register-screen {
    width: 100%;
    max-width: 480px;
    margin: 10vh auto;
    display: none;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

#auth-screen.active, #register-screen.active {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

#dashboard-screen {
    display: none;
}

#dashboard-screen.active {
    display: block;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.logo-accent {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text {
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label i {
    opacity: 0.7;
}

.form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.auth-toggle {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* --- Buttons --- */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #0b0f19;
    box-shadow: var(--shadow-neon);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 242, 254, 0.25);
}

.btn-accent {
    background: var(--accent-gradient);
    color: var(--text-main);
    box-shadow: var(--shadow-accent);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(168, 85, 247, 0.25);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

.btn-icon-only {
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

/* --- Dashboard Header --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.dashboard-header .logo {
    font-size: 1.6rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-display {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-admin {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid var(--accent);
    color: #c084fc;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
}

.action-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.card-action h2 i {
    font-size: 1.25rem;
}

.card-desc {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* --- Upload Module --- */
.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(0, 242, 254, 0.04);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.upload-limits {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.selected-file-info {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    gap: 1rem;
}

.selected-file-info i {
    font-size: 1.5rem;
    color: var(--primary);
}

.file-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-all;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-clear:hover {
    color: var(--danger);
}

/* --- Record Module --- */
.recorder-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.visualizer-container {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#recording-time {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 1px;
}

.visualizer-canvas {
    width: 100%;
    height: 60px;
    background: transparent;
    border-radius: 4px;
}

.record-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.recorder-controls {
    display: flex;
    gap: 1rem;
}

.btn-record {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-record:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-record.recording {
    animation: pulse 1.5s infinite;
}

.btn-stop {
    background: var(--text-main);
    color: var(--bg-dark);
}

#recorded-audio-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#recorded-audio-container audio {
    width: 100%;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* --- History/Transcript List --- */
.history-card {
    height: calc(100vh - 12rem);
    display: flex;
    flex-direction: column;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-container input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.transcripts-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.transcripts-list::-webkit-scrollbar, .scroll-box::-webkit-scrollbar {
    width: 6px;
}

.transcripts-list::-webkit-scrollbar-track, .scroll-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.transcripts-list::-webkit-scrollbar-thumb, .scroll-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.transcripts-list::-webkit-scrollbar-thumb:hover, .scroll-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.list-empty {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

.list-empty i {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Transcript Card Item */
.transcript-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.transcript-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateX(4px);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}

.item-meta span i {
    margin-right: 0.25rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-delete-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-delete-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* --- Processing Overlay & Spinner --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 11, 19, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-card {
    max-width: 450px;
    width: 90%;
    text-align: center;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 0 50px rgba(0, 242, 254, 0.15);
    border-color: rgba(0, 242, 254, 0.2);
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(0, 242, 254, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.magic-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.75rem;
    color: var(--primary);
    animation: pulseGlow 1.5s ease-in-out infinite;
}

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

@keyframes pulseGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; filter: drop-shadow(0 0 8px var(--primary)); }
}

/* --- Detail Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 11, 19, 0.8);
    backdrop-filter: blur(10px);
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-content {
    width: 100%;
    max-width: 1300px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border-color: rgba(255, 255, 255, 0.12);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.modal-header h2 {
    font-size: 1.8rem;
    color: var(--text-main);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--text-main);
    transform: rotate(90deg);
}

.modal-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.modal-meta i {
    margin-right: 0.25rem;
}

.modal-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex: 1;
    min-height: 0;
}

.modal-left, .modal-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    min-height: 0;
}

.audio-player-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-md);
}

.audio-player-container h3, .transcript-text-container h3, .protocol-container h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.audio-player-container audio {
    width: 100%;
}

.transcript-text-container, .protocol-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow: hidden;
}

.scroll-box {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.02);
}

#modal-transcript-text {
    color: var(--text-muted);
    font-style: italic;
    white-space: pre-wrap;
}

/* Protocol Section */
.protocol-container {
    border-color: rgba(168, 85, 247, 0.2);
}

.protocol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.protocol-header h3 {
    margin-bottom: 0;
}

.export-actions {
    display: flex;
    gap: 0.5rem;
}

/* Markdown Protocol Styling inside modal */
.markdown-body {
    color: var(--text-main);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: #c084fc;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.15);
    padding-bottom: 0.25rem;
}

.markdown-body h1 { font-size: 1.4rem; }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1.05rem; }

.markdown-body p {
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.markdown-body ul, .markdown-body ol {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.markdown-body li {
    margin-bottom: 0.35rem;
}

.markdown-body blockquote {
    background: rgba(168, 85, 247, 0.05);
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0 4px 4px 0;
}

.markdown-body strong {
    color: #e9d5ff;
}

/* --- Notification Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(17, 25, 40, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 2000;
    transition: var(--transition);
    transform: translateY(100px);
    opacity: 0;
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.info {
    border-color: var(--primary);
    color: var(--primary);
}

/* --- Responsive Adaptations --- */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .history-card {
        height: 600px;
    }

    .modal-body-grid {
        grid-template-columns: 1fr;
        height: calc(100% - 6rem);
        overflow-y: auto;
    }
    
    .modal-content {
        height: 95vh;
    }
    
    .modal-left, .modal-right {
        height: auto;
    }
    
    .transcript-text-container, .protocol-container {
        height: 400px;
    }
}

/* --- Navigation Tabs --- */
.nav-tabs-container {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

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

/* --- Admin Tables & Forms --- */
.table-scroll-container {
    overflow-x: auto;
    width: 100%;
    margin-top: 1rem;
    max-height: 400px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.admin-table th {
    font-family: 'Outfit', sans-serif;
    color: var(--text-muted);
    font-weight: 600;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table td .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin: 2px;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- Scrollable Text Boxes in Modal --- */
.transcript-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    width: 100%;
}

.transcript-header-row h3 {
    margin-bottom: 0;
}



.modal-content.modal-sm {
    max-width: 480px;
    height: auto;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.dict-list-container {
    max-height: 500px;
    overflow-y: auto;
}

/* --- Edit Textarea inside Detail Modal & Custom Selects --- */
.edit-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    flex-grow: 1;
    min-height: 100px;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.1);
}

.select-control {
    background-color: rgba(0, 0, 0, 0.25) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

.select-control option {
    background-color: #111928;
    color: var(--text-main);
}

/* --- DSGVO Legal Notice Box --- */
.legal-notice-box {
    background: rgba(168, 85, 247, 0.04);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    width: 100%;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}
.legal-header {
    font-weight: 600;
    color: #c084fc;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.legal-desc {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.legal-tip {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 0.6rem;
    margin-bottom: 0.75rem;
    border-left: 2px solid var(--accent);
}
.legal-tip strong {
    color: #e9d5ff;
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}
.legal-quote {
    font-style: italic;
    color: var(--text-main);
    font-size: 0.82rem;
}
.consent-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
.consent-checkbox-label input {
    cursor: pointer;
    accent-color: #a855f7;
}

/* --- Interactive Transcript Segments (Karaoke Effect) --- */
.ts-segment {
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: var(--text-main);
    display: inline;
}
.ts-segment:hover {
    background: rgba(0, 242, 254, 0.12);
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 242, 254, 0.5);
}
.ts-segment.active-playing {
    background: rgba(168, 85, 247, 0.25);
    color: #fff;
    border-bottom: 2px solid #c084fc;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.15);
    animation: activePulse 2s infinite ease-in-out;
}
@keyframes activePulse {
    0%, 100% { opacity: 1; }
    50% { background: rgba(168, 85, 247, 0.35); }
}

.hidden {
    display: none !important;
}

/* --- Mobile Optimization (Smartphones) --- */
@media (max-width: 768px) {
    .modal {
        padding: 0.25rem;
    }
    
    .modal-content {
        padding: 1rem;
        height: 100vh;
        max-height: 100vh;
        border-radius: var(--radius-md);
        display: flex;
        flex-direction: column;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
        word-break: break-word;
    }
    
    .modal-meta {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        margin-bottom: 1rem;
    }
    
    .modal-body-grid {
        grid-template-columns: 1fr;
        height: calc(100% - 5rem);
        overflow-y: auto;
        gap: 1.5rem;
        padding-right: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-left, .modal-right {
        height: auto;
        min-height: 0;
        gap: 1rem;
    }
    
    .transcript-text-container, .protocol-container {
        height: 480px; /* Taller height on mobile */
        padding: 1rem;
        overflow: hidden;
    }
    
    .scroll-box {
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }
    
    .edit-textarea {
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        min-height: 200px;
    }
    
    /* Make button controls smaller and wrap nicely */
    .export-actions {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    
    .export-actions .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .transcript-header-row, .protocol-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .transcript-header-row h3, .protocol-header h3 {
        margin: 0;
    }
}


