/* Optotoolkit - Modern Clinical Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    /* Light Theme (Default) */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;
    --bg-header: #0f172a;
    --bg-header-accent: #1e293b;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #f8fafc;
    
    --accent-red: #e11d48;
    --accent-red-hover: #be123c;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-focus: #2563eb;
    --focus-ring: rgba(37, 99, 235, 0.18);
    
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --bg-base: #090d16;
    --bg-surface: #111827;
    --bg-surface-alt: #1f2937;
    --bg-header: #030712;
    --bg-header-accent: #111827;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-light: #f9fafb;
    
    --accent-red: #fb7185;
    --accent-red-hover: #f43f5e;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #60a5fa;
    
    --border-color: #1f2937;
    --border-strong: #374151;
    --input-bg: #1f2937;
    --input-border: #374151;
    --input-focus: #3b82f6;
    --focus-ring: rgba(59, 130, 246, 0.25);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header & Brand Banner */
.simple-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--bg-header), var(--bg-header-accent));
    color: var(--text-light);
    border-bottom: 3px solid var(--accent-red);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-badge {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    letter-spacing: 0.05em;
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35);
}

.simple-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.simple-header p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.8;
    color: #94a3b8;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.save-status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.save-status-dot.dot-connected {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.save-status-dot.dot-syncing {
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
    animation: pulseSync 1s infinite alternate;
}

.save-status-dot.dot-error {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.save-status-dot.dot-offline {
    background: #94a3b8;
    box-shadow: none;
}

@keyframes pulseSync {
    from { opacity: 0.4; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.2); }
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Page Layout & Sections */
.section {
    display: none;
    padding: 24px;
    max-width: 1320px;
    margin: 0 auto;
}

.section.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

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

/* Card Fieldset Component */
fieldset {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    break-inside: avoid;
    page-break-inside: avoid;
    position: relative;
}

fieldset:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

legend {
    font-weight: 700;
    font-size: 14px;
    color: var(--accent-red);
    padding: 4px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Tables Styling */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

td, th {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
}

td:last-child, th:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

th {
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tbody tr:hover {
    background: rgba(37, 99, 235, 0.03);
}

/* Inputs & Form Controls */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    margin-top: 4px;
    box-sizing: border-box;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 13px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

label {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

input[type="checkbox"], input[type="radio"] {
    accent-color: var(--accent-red);
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
    cursor: pointer;
}

.compact-input { width: 85px; text-align: center; font-weight: 600; }
.compact-input-short { width: 65px; text-align: center; font-weight: 600; }

#printContainer {
    display: none;
}

@media (max-width: 768px) {
    .section { padding: 14px; }
    fieldset { padding: 14px; }
    table { font-size: 12px; }
    td, th { padding: 6px 8px; }
}
