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

:root {
    /* Modern Slate/Neutral Palette - Minimalist SaaS Style */
    --primary: #0f172a;          /* Slate 900 - Deep charcoal for primary actions */
    --primary-hover: #1e293b;    /* Slate 800 - Hover state */
    --secondary: #475569;        /* Slate 600 - Secondary elements */
    --accent: #3b82f6;           /* Blue 500 - Subtle medical/tech accent */
    --accent-light: #60a5fa;     /* Blue 400 - Lighter accent */
    
    /* Status Colors - Muted professional tones */
    --success: #10b981;          /* Emerald 500 */
    --warning: #f59e0b;          /* Amber 500 */
    --danger: #ef4444;           /* Red 500 */
    
    /* Backgrounds - Clean slate neutrals */
    --background: #f8fafc;       /* Slate 50 - Page background */
    --surface: #ffffff;          /* Pure white cards */
    --surface-secondary: #f1f5f9; /* Slate 100 - Subtle backgrounds */
    
    /* Text - High contrast slate */
    --text: #0f172a;             /* Slate 900 - Primary text */
    --text-secondary: #475569;   /* Slate 600 - Secondary text */
    --text-muted: #94a3b8;       /* Slate 400 - Muted text */
    
    /* Borders - Subtle neutrals */
    --border: #e2e8f0;           /* Slate 200 */
    --border-light: #f1f5f9;     /* Slate 100 */
    
    /* Shadows - Softer, minimal */
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
    
    /* Radius - Modern, consistent */
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    font-feature-settings: 'cv05', 'cv08', 'cv11'; /* Inter font optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Tooltip Styling */
.tooltip-trigger {
    position: relative;
    cursor: default;
}

.tooltip-trigger:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    margin-bottom: 0.5rem;
    pointer-events: none;
}

.tooltip-trigger:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    z-index: 1000;
    margin-bottom: -6px;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface-secondary);
}

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

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Form Styles */
#soep-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    flex-wrap: wrap;
}

.hint {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.soep-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
}

input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-secondary);
    border-color: var(--secondary);
}

.btn-info {
    background: var(--accent);
    color: white;
}

.btn-info:hover {
    background: var(--accent-light);
}

.btn-info:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Result Message */
.result-message {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.result-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.result-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Dashboard Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 0.75rem;
}

.filters select {
    width: auto;
    min-width: 150px;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

/* Stats Cards */
.task-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.stat-card {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-light);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.stat-card.active {
    border-color: var(--primary);
    background: var(--surface-secondary);
}

.stat-card[data-urgency="high"] {
    border-left: 3px solid var(--danger);
}

.stat-card[data-urgency="medium"] {
    border-left: 3px solid var(--warning);
}

.stat-card[data-urgency="low"] {
    border-left: 3px solid var(--success);
}

.stat-card[data-urgency="high"].active {
    border: 2px solid var(--danger);
    border-left: 3px solid var(--danger);
    background: #fef2f2;
}

.stat-card[data-urgency="medium"].active {
    border: 2px solid var(--warning);
    border-left: 3px solid var(--warning);
    background: #fefce8;
}

.stat-card[data-urgency="low"].active {
    border: 2px solid var(--success);
    border-left: 3px solid var(--success);
    background: #f0fdf4;
}

.stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Tasks Container */
/* Kanban Board Layout */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.kanban-column {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.kanban-column-header {
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-column-header.in-progress {
    background: #fef9ec;
    border-bottom-color: var(--warning);
}

.kanban-column-header.completed {
    background: #f0fdf4;
    border-bottom-color: var(--success);
}

.kanban-column-header h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.column-count {
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.kanban-tasks {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: var(--radius);
}

/* Task Card */
.task-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
}

.task-card.high {
    border-left: 3px solid var(--danger);
}

.task-card.medium {
    border-left: 3px solid var(--warning);
}

.task-card.low {
    border-left: 3px solid var(--success);
}

.task-checkbox {
    margin-top: 0.25rem;
}

.task-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.task-content {
    flex: 1;
}

.task-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.task-description {
    font-weight: 500;
    color: var(--text);
}

.patient-id {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.date-badge {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 400;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-doctor {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.badge-assistant {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.badge-urgency-high {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.badge-urgency-medium {
    background: #fefce8;
    color: #ca8a04;
    border: 1px solid #fef08a;
}

.badge-urgency-low {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.task-actions button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.task-actions button:hover {
    background: #e5e7eb;
}

.task-actions button.btn-start {
    background: #fefce8;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.task-actions button.btn-start:hover {
    background: #fef9c3;
    border-color: #fde047;
}

.task-actions button.btn-complete {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.task-actions button.btn-complete:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.task-actions button.btn-reopen {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #dbeafe;
}

.task-actions button.btn-reopen:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
}

.task-actions button.btn-reopen:hover {
    background: #bfdbfe;
}

.task-actions button:hover {
    background: var(--background);
}

.task-actions button.complete-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

/* Task completed state */
.task-card.done {
    opacity: 0.6;
}

.task-card.done .task-description {
    text-decoration: line-through;
}

/* Recording Section */
.recording-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-record {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-record:hover {
    background: var(--primary-hover);
}

.btn-record.recording {
    background: #ef4444;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.record-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #fee2e2;
    border: 2px solid #fca5a5;
    border-radius: var(--radius);
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.recording-time {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #dc2626;
    font-size: 1rem;
}

.transcription-preview {
    width: 100%;
    padding: 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.transcription-preview .loading-message {
    color: var(--text-secondary);
    font-style: italic;
}

.transcription-preview .success-message {
    color: var(--success);
    font-weight: 500;
}

.transcription-preview .error-message {
    color: var(--danger);
    font-weight: 500;
}

/* ICPC Section */
.icpc-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.icpc-section > label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.icpc-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.icpc-card {
    display: grid;
    grid-template-columns: 40px 80px 1fr 100px;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icpc-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.icpc-card.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.icpc-card.high {
    border-left: 4px solid var(--success);
}

.icpc-card.medium {
    border-left: 4px solid var(--warning);
}

.icpc-card.low {
    border-left: 4px solid #94a3b8;
}

.icpc-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
}

.icpc-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.icpc-desc {
    color: var(--text);
    font-weight: 500;
}

.confidence-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
}

.icpc-card.high .confidence-badge {
    background: #dcfce7;
    color: #166534;
}

.icpc-card.medium .confidence-badge {
    background: #fef3c7;
    color: #92400e;
}

.icpc-card.low .confidence-badge {
    background: #f1f5f9;
    color: #475569;
}

/* Lab Measurements Section */
.lab-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.lab-section > label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.lab-measurements {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lab-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.lab-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
}

.lab-desc {
    color: var(--text);
    font-weight: 500;
}

.lab-value {
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recording-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .icpc-card {
        grid-template-columns: 40px 1fr;
        gap: 0.5rem;
    }
    
    .icpc-code,
    .confidence-badge {
        grid-column: 2;
    }
    
    .icpc-desc {
        grid-column: 1 / -1;
        margin-top: 0.5rem;
    }
    
    .lab-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .lab-value {
        text-align: left;
    }
}
