@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&family=Outfit:wght@200..800&family=Tilt+Neon&display=swap');

:root {
    --bg-dark: #050505;
    --bg-card: rgba(15, 31, 61, 0.4);
    --bg-card-hover: rgba(15, 31, 61, 0.6);
    --border-color: rgba(76, 214, 255, 0.2);
    --border-hover: rgba(76, 214, 255, 0.5);
    --primary-cyan: #4CD6FF;
    --primary-fuchsia: #E030F7;
    --text-white: #ffffff;
    --text-muted: #a0aec0;
    --font-outfit: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-space: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --input-bg: rgba(5, 5, 5, 0.4);
    --canvas-bg: #0f172a;
    --header-bg: rgba(5, 5, 5, 0.8);
}

body.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(15, 23, 42, 0.15);
    --border-hover: rgba(15, 23, 42, 0.3);
    --primary-cyan: #0ea5e9;
    --primary-fuchsia: #d946ef;
    --text-white: #0f172a;
    --text-muted: #475569;
    --glass-shadow: 0 8px 32px 0 rgba(148, 163, 184, 0.1);
    --input-bg: #f1f5f9;
    --canvas-bg: #f8fafc;
    --header-bg: rgba(248, 250, 252, 0.9);
}

body.light-theme .bg-gradient-shapes .shape-1 {
    background: radial-gradient(circle, rgba(14, 165, 233, 0.12) 0%, transparent 70%);
}
body.light-theme .bg-gradient-shapes .shape-2 {
    background: radial-gradient(circle, rgba(217, 70, 239, 0.12) 0%, transparent 70%);
}


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

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-outfit);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Gradients */
.bg-gradient-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.shape-1 {
    position: absolute;
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(224, 48, 247, 0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
}

.shape-2 {
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(76, 214, 255, 0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
}

/* Glassmorphism Container */
.glass-container {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-container:hover {
    border-color: var(--border-hover);
    box-shadow: 0 8px 32px 0 rgba(76, 214, 255, 0.15);
}

/* Login Layout */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    text-align: center;
}

.login-logo {
    font-family: var(--font-space);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--primary-cyan), var(--primary-fuchsia));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-cyan);
    margin-bottom: 8px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(5, 5, 5, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-white);
    font-family: var(--font-outfit);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(76, 214, 255, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, #0088cc 100%);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-family: var(--font-space);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 214, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 214, 255, 0.5);
    background: linear-gradient(135deg, #7be2ff 0%, var(--primary-cyan) 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-banner {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Dashboard Layout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    font-family: var(--font-space);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 1px;
    color: var(--primary-cyan);
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--primary-fuchsia);
    color: var(--primary-fuchsia);
    border-radius: 6px;
    font-family: var(--font-space);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: var(--primary-fuchsia);
    color: var(--text-white);
    box-shadow: 0 0 15px rgba(224, 48, 247, 0.4);
}

.dashboard-main {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
}

@media (max-width: 1100px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }
}

/* Left workspace */
.workspace-left {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Top Recorder Widget */
.recorder-card {
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
}

.mic-button-container {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4c4c, #cc0000);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    font-size: 2.2rem;
    box-shadow: 0 4px 15px rgba(255, 76, 76, 0.4);
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 76, 76, 0.6);
}

.mic-button.recording {
    background: linear-gradient(135deg, #e030f7, #9d00b3);
    box-shadow: 0 4px 20px rgba(224, 48, 247, 0.5);
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 76, 76, 0.4);
    z-index: 1;
    transform: scale(1);
    opacity: 0;
}

.recording ~ .pulse-ring {
    background: rgba(224, 48, 247, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.recorder-info {
    flex-grow: 1;
}

.recorder-title {
    font-family: var(--font-space);
    font-size: 1.2rem;
    margin-bottom: 6px;
    color: var(--primary-cyan);
}

.recorder-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.transcript-area {
    width: 100%;
    height: 120px;
    margin-top: 15px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-white);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    resize: none;
}

.recorder-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 15px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(76, 214, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--primary-cyan);
    border-radius: 6px;
    font-family: var(--font-space);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(76, 214, 255, 0.25);
    border-color: var(--primary-cyan);
    color: var(--text-white);
}

.btn-accent {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-fuchsia) 0%, #a612bb 100%);
    border: none;
    color: var(--text-white);
    border-radius: 6px;
    font-family: var(--font-space);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(224, 48, 247, 0.3);
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(224, 48, 247, 0.5);
}

.btn-accent:disabled {
    background: rgba(150, 150, 150, 0.2);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

/* Tabs & Forms Workspace */
.workspace-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
    overflow-x: auto;
    gap: 5px;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-space);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-cyan);
}

.tab-btn.active {
    color: var(--primary-cyan);
    border-bottom-color: var(--primary-cyan);
}

.form-workspace {
    padding: 30px;
}

.tab-content {
    display: none;
}

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

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

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.form-field {
    margin-bottom: 18px;
}

.form-field label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-field-textarea {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .form-field-textarea {
        grid-column: span 1;
    }
}

.field-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-white);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: all 0.3s;
}

.field-input:focus {
    outline: none;
    border-color: var(--primary-cyan);
}

textarea.field-input {
    height: 90px;
    resize: vertical;
}

/* Bullet Items (PGM, Objectives, etc.) */
.bullet-list-builder {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bullet-item {
    display: flex;
    gap: 10px;
}

.btn-remove-bullet {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-remove-bullet:hover {
    background: #ef4444;
    color: white;
}

/* Apply to Map / Sync Muscle Button */
.btn-sync-muscles {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    border-radius: 6px;
    font-family: var(--font-space);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-sync-muscles::before {
    content: '🔴';
    font-size: 0.7rem;
}

.btn-sync-muscles:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
    transform: translateY(-1px);
}

.btn-sync-muscles:active {
    transform: translateY(0);
}

.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Pain Map Canvas Card */
.pain-map-card {
    padding: 25px;
}

.pain-map-title {
    font-family: var(--font-space);
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-cyan);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-wrapper {
    width: 100%;
    position: relative;
    background: var(--canvas-bg);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1.1;
    border: 1px solid var(--border-color);
}

#painMapCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    gap: 10px;
}

.btn-tool {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-tool:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.btn-clear {
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.brush-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Actions panel */
.actions-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    padding: 35px;
    border-radius: 12px;
}

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

.modal-title {
    font-family: var(--font-space);
    font-size: 1.3rem;
    color: var(--primary-cyan);
}

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

.btn-close-modal:hover {
    color: var(--text-white);
}

/* Settings Button */
.btn-settings {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-settings:hover {
    color: var(--primary-cyan);
    border-color: var(--primary-cyan);
}

/* PDF Preview Frame */
.pdf-preview-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pdf-preview-container {
    width: 100%;
    height: 350px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(5, 5, 5, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
}

.pdf-preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Status Notifications */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: 8px;
    background: #0f1f3d;
    border-left: 4px solid var(--primary-cyan);
    color: var(--text-white);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transform: translateY(150px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification.show {
    transform: translateY(0);
}

.notification.success {
    border-left-color: #10b981;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.info {
    border-left-color: var(--primary-cyan);
}

/* Loading Spinner Overlay */
.spinner-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(76, 214, 255, 0.2);
    border-top: 3px solid var(--primary-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner-text {
    font-family: var(--font-space);
    font-size: 1rem;
    color: var(--primary-cyan);
}

/* Header Language Selector styling */
.lang-selector-header {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}
body.light-theme .lang-selector-header {
    background: rgba(15, 23, 42, 0.05);
}

/* Login screen language switcher positioner */
.login-lang-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    z-index: 10;
}
body.light-theme .login-lang-container {
    background: rgba(15, 23, 42, 0.05);
}

.btn-lang {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-space);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-lang:hover {
    color: var(--primary-cyan);
}

.btn-lang.active {
    background: var(--primary-cyan);
    color: #050505;
}
body.light-theme .btn-lang.active {
    color: #ffffff;
}

/* Modern Sliding Theme Switch Toggle */
.theme-switch-container {
    display: flex;
    align-items: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 34px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

body.light-theme .theme-slider {
    background-color: rgba(15, 23, 42, 0.05);
}

.theme-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--primary-cyan);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.theme-switch input:checked + .theme-slider::before {
    transform: translateX(24px);
    background-color: var(--primary-fuchsia);
}

.switch-icon {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    transition: color 0.3s;
    z-index: 1;
}

.switch-icon.sun {
    margin-left: -1px;
}

.switch-icon.moon {
    margin-right: -1px;
}

.theme-switch input:checked + .theme-slider .switch-icon.moon {
    color: #ffffff;
}

.theme-switch input:not(:checked) + .theme-slider .switch-icon.sun {
    color: var(--primary-cyan);
}

/* Settings button hover scaling */
.btn-settings:hover {
    transform: scale(1.05);
}

/* Document History Card & List styling */
.history-card {
    padding: 25px;
    margin-top: 10px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 15px;
    padding-right: 5px;
}

/* Custom scrollbar for history list */
.history-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track {
    background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.history-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    display: block;
    padding: 15px 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
body.light-theme .history-item {
    background: rgba(15, 23, 42, 0.02);
}

.history-item:hover {
    border-color: var(--primary-cyan);
    background: rgba(76, 214, 255, 0.06);
    transform: translateY(-1px);
}

.history-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-grow: 1;
    min-width: 0;
    margin-right: 10px;
}

.history-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-space);
}

.history-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-delete-history {
    background: transparent;
    border: none;
    color: #f87171;
    padding: 6px;
    cursor: pointer;
    font-size: 1.15rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.btn-delete-history:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* Whisper Status Bar */
.whisper-status-bar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.light-theme .whisper-status-bar {
    background: rgba(15, 23, 42, 0.03);
}

.whisper-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.whisper-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.whisper-status-dot.loading {
    background: #f59e0b;
    animation: whisperPulse 1.2s ease-in-out infinite;
}

.whisper-status-dot.ready {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.whisper-status-dot.transcribing {
    background: var(--primary-cyan);
    animation: whisperPulse 0.8s ease-in-out infinite;
}

.whisper-status-dot.error {
    background: #ef4444;
}

@keyframes whisperPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.whisper-status-text {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.whisper-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

body.light-theme .whisper-progress-container {
    background: rgba(15, 23, 42, 0.06);
}

.whisper-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-cyan), #818cf8);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.whisper-load-btn {
    background: rgba(76, 214, 255, 0.08);
    border: 1px solid rgba(76, 214, 255, 0.25);
    color: var(--primary-cyan);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.whisper-load-btn:hover {
    background: rgba(76, 214, 255, 0.15);
    border-color: var(--primary-cyan);
}

.whisper-load-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.whisper-load-btn.hidden {
    display: none;
}

/* Viewport and layout overflow safety */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.workspace-left, .sidebar-right {
    min-width: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 1100px) {
    .dashboard-main {
        grid-template-columns: 1fr;
        margin: 20px auto;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
        align-items: center;
        text-align: center;
    }
    
    .header-brand {
        font-size: 1.3rem;
    }

    .header-meta {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        display: flex;
    }

    /* Put practitioner info below the header controls on mobile */
    .header-user {
        order: 2;
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }

    .lang-selector-header,
    .theme-switch-container,
    .btn-settings,
    .btn-logout {
        order: 1;
    }

    .recorder-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px;
        gap: 20px;
    }

    .mic-button-container {
        margin: 0 auto;
    }

    .recorder-actions {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }

    .recorder-actions button {
        flex: 1 1 120px;
    }

    .form-workspace {
        padding: 20px;
    }

    /* Convert tab bar into wrapped, highlighted pill buttons instead of horizontal scroll */
    .workspace-tabs {
        flex-wrap: wrap;
        gap: 8px;
        border-bottom: none;
        margin-bottom: 20px;
        overflow-x: visible;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 0.82rem;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--border-color);
        border-radius: 30px;
        color: var(--text-muted);
        white-space: normal;
        text-align: center;
        flex: 1 1 auto;
        min-width: 120px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: none;
    }

    body.light-theme .tab-btn {
        background: rgba(15, 23, 42, 0.04);
    }

    .tab-btn.active {
        background: var(--primary-cyan);
        color: #050505 !important;
        border-color: var(--primary-cyan);
        box-shadow: 0 0 10px rgba(76, 214, 255, 0.35);
    }

    body.light-theme .tab-btn.active {
        color: #ffffff !important;
    }
}

@media (max-width: 480px) {
    .form-workspace {
        padding: 15px;
    }

    .login-card {
        padding: 25px 20px;
    }

    .modal-content {
        padding: 20px;
    }

    /* Stack settings modal buttons vertically on very small screens */
    #settingsModal .modal-content > div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #settingsModal .modal-content button {
        width: 100% !important;
    }
}

