/* =========================================================
   PATHMAP STUDIO - CLINICAL SAAS THEME (stylesheet.css)
   ========================================================= */

:root {
    /* Color Palette */
    --bg-base: #020617;
    --bg-panel: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Brand Accents */
    --accent-primary: #38bdf8;
    --accent-primary-hover: #0284c7;
    --accent-success: #10b981;
    --accent-success-hover: #059669;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    /* Layout */
    --border-color: #334155;
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5 { margin-top: 0; color: var(--text-main); font-weight: 700; }
a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    font-family: var(--font-ui);
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background-color: var(--accent-primary); color: #020617; }
.btn-primary:hover:not(:disabled) { background-color: #7dd3fc; }

.btn-success { background-color: var(--accent-success); color: #022c22; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
.btn-success:hover:not(:disabled) { background-color: var(--accent-success-hover); color: white; transform: translateY(-1px); }

.btn-danger { background-color: var(--accent-danger); color: white; }
.btn-danger:hover:not(:disabled) { background-color: #b91c1c; }

.btn-danger-outline { background-color: transparent; border: 1px solid var(--accent-danger); color: var(--accent-danger); }
.btn-danger-outline:hover:not(:disabled) { background-color: rgba(239, 68, 68, 0.1); }

.btn-secondary { background-color: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-main); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-primary); color: var(--accent-primary); }

.btn-outline-success { background-color: transparent; border: 1px solid var(--accent-success); color: var(--accent-success); }
.btn-outline-success:hover:not(:disabled) { background-color: rgba(16, 185, 129, 0.1); }

.btn-outline-warning { background-color: transparent; border: 1px solid var(--accent-warning); color: var(--accent-warning); }
.btn-outline-warning:hover:not(:disabled) { background-color: rgba(245, 158, 11, 0.1); }

.btn-text { background: transparent; border: none; color: var(--accent-primary); padding: 0; }
.btn-text:hover:not(:disabled) { color: #7dd3fc; text-decoration: underline; }

/* =========================================
   FORMS & INPUTS
   ========================================= */
textarea, select, input[type="text"], input[type="number"], input[type="password"], input[type="url"] {
    width: 100%;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    padding: 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

textarea:focus, select:focus, input:focus { outline: none; border-color: var(--accent-primary); }
textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); }

.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* Select Dropdown Arrow Hack */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    padding-right: 2rem;
}

/* Switches & Checkboxes */
.custom-checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-main); cursor: pointer; }
.custom-checkbox input { width: 16px; height: 16px; accent-color: var(--accent-primary); }

.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; padding: 8px 0; border-bottom: 1px solid var(--border-color); cursor: pointer; }
.switch-row:last-child { border-bottom: none; }

.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-color); transition: .3s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* Sliders */
.slider-group label { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 4px; font-weight: 600; color: var(--text-muted); align-items: center; text-transform: uppercase; }
.slider-group input[type="range"] { width: 100%; accent-color: var(--accent-primary); }
.slider-group input[type="number"] { width: 60px; padding: 2px 4px; height: 24px; text-align: center; font-family: var(--font-mono); background: var(--bg-base); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 4px; }

/* =========================================
   LAYOUT & CONTAINERS
   ========================================= */
.app-container { min-height: 100vh; display: flex; flex-direction: column; }

/* Navigation */
.top-nav { background-color: var(--bg-panel); border-bottom: 1px solid var(--border-color); padding: 0.75rem 1.5rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; }
.nav-brand h1 { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.5px; }
.nav-brand h1 span { color: var(--accent-primary); }
.nav-brand small { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }
.nav-controls { display: flex; align-items: center; gap: 1rem; }
.key-status { font-size: 0.8rem; font-family: var(--font-mono); color: var(--accent-warning); }

/* Utility Bar */
.utility-bar { background-color: var(--bg-base); padding: 0.5rem 1.5rem; display: flex; gap: 1.5rem; font-size: 0.8rem; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.utility-bar a { color: var(--text-muted); font-weight: 500; }
.utility-bar a:hover { color: var(--accent-primary); }

/* Main Workspace */
.workspace { max-width: 1400px; margin: 1.5rem auto; padding: 0 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; flex-grow: 1; width: 100%; box-sizing: border-box; }

.panel-card { background-color: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 0.75rem; padding: 1.5rem; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; }
.panel-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }

.claim-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; flex-wrap: wrap; gap: 1rem; }
.checkbox-group { display: flex; gap: 1rem; }

/* Grids */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.config-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.flexible-box { background: var(--bg-base); padding: 15px; border-radius: 8px; border: 1px solid var(--accent-primary); margin-bottom: 1.5rem; }
.toggle-box { background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 8px; }

/* Data Ops Bar */
.data-ops-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; background: var(--bg-panel); padding: 1rem; border-radius: 0.5rem; border: 1px solid var(--border-color); align-items: center; }
.ops-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-right: 10px; }
.v-divider { width: 1px; height: 20px; background: var(--border-color); margin: 0 10px; }
.evidence-list { font-size: 0.75rem; color: var(--accent-success); display: flex; flex-direction: column; gap: 2px; width: 100%; margin-top: 5px; }

/* Assistant Terminal */
.assistant-config-box { background: var(--bg-base); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); margin-bottom: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; font-size: 0.85rem; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-card); }
.directives-list { display: flex; flex-direction: column; gap: 4px; }
.dropdown-label { font-weight: 600; font-size: 0.8rem; color: var(--text-muted); margin-top: 10px; }
.assistant-response { margin-top: 1.5rem; padding: 1.5rem; background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 8px; }

/* Delivery Engine & Results */
.delivery-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.visualizations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.viz-box { background: var(--bg-panel); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.viz-box h4 { color: var(--text-muted); text-transform: uppercase; font-size: 0.8rem; margin-bottom: 10px; }

.trace-output { background: var(--bg-base); border: 1px solid var(--border-color); border-radius: 8px; padding: 20px; font-family: var(--font-ui); }
.trace-output pre { white-space: pre-wrap; word-wrap: break-word; font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.6; background: var(--bg-panel); padding: 1rem; border-radius: 0.5rem; border: 1px solid var(--border-color); color: var(--text-main); margin: 0; }
.authorship-header { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-primary); border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1rem; }

/* Quadrant Results Styling */
.quadrant-block { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px dashed var(--border-color); }
.quadrant-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.quad-title { font-size: 1.1rem; font-weight: 700; color: var(--accent-primary); margin-bottom: 0.8rem; text-transform: uppercase; font-family: var(--font-mono); }
.score-bar-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border-color); background: var(--bg-panel); padding: 1rem; border-radius: 0.5rem; }

/* Alerts & Logs */
.alert-warning { color: var(--accent-warning); font-size: 0.85rem; font-weight: 600; padding: 10px; background: rgba(245, 158, 11, 0.1); border-radius: 6px; border: 1px solid var(--accent-warning); margin-bottom: 1rem; }
.alert-danger { color: var(--accent-danger); font-size: 0.85rem; font-weight: 600; padding: 10px; background: rgba(239, 68, 68, 0.1); border-radius: 6px; border: 1px solid var(--accent-danger); margin-bottom: 1rem; }
.status-area { background: var(--bg-card); border-radius: 0.5rem; padding: 1rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-main); border-left: 4px solid var(--accent-primary); max-height: 250px; overflow-y: auto; }

/* Overlays & Modals */
.full-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(2, 6, 23, 0.95); backdrop-filter: blur(8px); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 9999; color: white; text-align: center; }
.learning-spinner { width: 50px; height: 50px; border: 4px solid var(--border-color); border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px; }
.overlay-subtitle { font-size: 0.9rem; color: var(--accent-success); margin-bottom: 20px; font-family: var(--font-mono); }
@keyframes spin { 100% { transform: rotate(360deg); } }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(2, 6, 23, 0.8); display: none; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(4px); }
.modal-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 30px; width: 90%; box-shadow: 0 10px 25px rgba(0,0,0,0.8); display: flex; flex-direction: column; }
.modal-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions-col { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.modal-actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-footer-links { margin-top: 15px; display: flex; justify-content: center; gap: 15px; font-size: 0.8rem; color: var(--text-muted); }

.license-text-box { max-height: 50vh; overflow-y: auto; background: var(--bg-base); padding: 15px; border-radius: 8px; font-size: 0.8rem; font-family: var(--font-mono); color: var(--text-muted); border: 1px solid var(--border-color); }
.dp-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1rem; max-height: 300px; overflow-y: auto; }
.prompt-editors { display: flex; flex-direction: column; gap: 20px; overflow-y: auto; padding-right: 10px; }

/* Toast Notifications */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); padding: 12px 24px; border-radius: 8px; font-size: 0.85rem; font-family: var(--font-mono); z-index: 11000; box-shadow: 0 5px 15px rgba(0,0,0,0.5); animation: fadeInUp 0.3s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px);} to { opacity: 1; transform: translateY(0);} }

/* Misc & Footer */
.app-footer { text-align: center; padding: 2rem; border-top: 1px solid var(--border-color); margin-top: 2rem; color: var(--text-muted); font-size: 0.8rem; }
.print-footer-watermark { display: none; }

/* =========================================
   PRINT STYLES
   ========================================= */
@media print {
    body { background: white; padding: 0; margin: 0; color: black; }
    .app-container { max-width: 100%; margin: 0; padding: 0; display: block; }
    .top-nav, .utility-bar, #controlsPanel, .data-ops-bar, .delivery-actions, .panel-header, .claim-actions, #knowledgeDrawer, .modal-overlay, .toast, .app-footer { display: none !important; }
    
    .panel-card { border: none; padding: 0; background: transparent; }
    .trace-output pre { background: transparent; border: none; color: black; padding: 0; }
    
    #assistantPanel { display: block !important; margin-top: 2rem !important; page-break-before: always; border: none; background: transparent; }
    .assistant-config-box, #assistantQueryInput, #askAssistantBtn, #cancelAssistantBtn { display: none !important; }
    
    .print-footer-watermark { display: block !important; position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; padding: 10px 0; font-size: 0.75rem; color: #64748b; font-family: monospace; background: white; border-top: 1px dashed #cbd5e1; z-index: 9999; }
    body { padding-bottom: 60px !important; }
}

/* =========================================
   LEGACY OVERRIDES
   ========================================= */
.sponsor-msg { display: none !important; }
#toon-card, #toggleToonBtn { display: none !important; }