/* nsnu.css - Vibrant Unified Workspace */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --bg-panel: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; color: var(--text-main); background: var(--bg-main); height: 100vh; overflow: hidden; }

/* Header with vibrant gradient */
.app-header { 
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 100%); 
    color: white; 
    padding: 15px 25px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}
.app-header h1 { font-size: 1.4rem; margin: 0; font-weight: 600; letter-spacing: 0.5px; }

/* Main Workspace */
.workspace { display: flex; height: calc(100vh - 62px); }

/* Left Panel: Persistent State (SSOT) */
.panel-state { 
    width: 35%; 
    background: var(--bg-panel); 
    border-right: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto; 
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}
.panel-state h2 { font-size: 1.2rem; color: var(--primary); margin-bottom: 15px; border-bottom: 2px solid #e0e7ff; padding-bottom: 8px; }

/* I/O Areas */
.matrix-io { display: flex; gap: 15px; margin-bottom: 20px; }
textarea { 
    font-family: "Courier New", monospace; 
    font-size: 14px; 
    padding: 12px; 
    border: 1px solid var(--border); 
    border-radius: 6px;
    width: 50%; 
    resize: none; 
    background: #f8fafc;
    color: #0f172a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }
canvas { border: 1px solid var(--border); width: 50%; aspect-ratio: 1; border-radius: 6px; background: white; }
svg { width: 100%; height: 280px; border: 1px solid var(--border); background: #ffffff; border-radius: 6px; margin-top: 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.02); }

/* Right Panel: Tabbed Analysis */
.panel-analysis { width: 65%; display: flex; flex-direction: column; background: var(--bg-main); }

/* Colorful Tabs */
.tabs { display: flex; background: #e2e8f0; }
.tab-btn { 
    flex: 1; background: none; border: none; padding: 15px; cursor: pointer; 
    font-weight: 600; color: var(--text-muted); transition: all 0.3s ease; 
    border-top: 3px solid transparent;
}
.tab-btn:hover { background: #cbd5e1; color: var(--text-main); }
.tab-btn.active { background: var(--bg-panel); color: var(--primary); border-top: 3px solid var(--primary); box-shadow: 0 -2px 10px rgba(0,0,0,0.05); }

/* Tab Content */
.tab-content { display: none; padding: 30px; overflow-y: auto; height: 100%; background: var(--bg-panel); }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.tab-content h2 { color: var(--text-main); margin-bottom: 20px; font-size: 1.5rem; }

/* Controls */
.control-group { 
    background: #f1f5f9; padding: 15px 20px; border: 1px solid var(--border); 
    margin-bottom: 20px; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; 
}
button, input[type="button"] { 
    background: var(--primary); color: white; border: none; padding: 8px 16px; 
    border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; 
    transition: all 0.2s; box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}
button:hover, input[type="button"]:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3); }
input[type="button"].btn-success { background: var(--success); box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2); }
input[type="button"].btn-success:hover { background: #059669; }
input[type="button"].btn-danger { background: var(--danger); box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
input[type="button"].btn-danger:hover { background: #dc2626; }
select, input[type="text"] { padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 14px; outline: none; }
select:focus, input[type="text"]:focus { border-color: var(--primary); }

/* Pedagogy / Collapsible Tutorials */
.pedagogy-card { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--secondary); border-radius: 6px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
details { border-radius: 6px; overflow: hidden; }
summary { font-weight: 600; padding: 15px 20px; cursor: pointer; background: #f8fafc; user-select: none; color: var(--text-main); font-size: 1.1rem; transition: background 0.2s; }
summary:hover { background: #f1f5f9; }
details p, details ul { padding: 15px 20px; margin: 0; font-size: 14.5px; color: #475569; }
details ul { padding-left: 40px; }
code { background: #e2e8f0; color: #b91c1c; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.citation { font-style: italic; font-size: 0.9em; color: var(--text-muted); background: #f1f5f9; padding: 15px; border-radius: 6px; border-left: 4px solid var(--primary); margin-bottom: 20px;}

/* Status Buffers */
.status-box { padding: 15px; border-radius: 6px; margin-bottom: 15px; font-family: monospace; font-size: 14px; border: 1px solid; }
.status-trajectories { background: #fef9c3; border-color: #fef08a; color: #854d0e; }
.status-links { background: #dbeafe; border-color: #bfdbfe; color: #1e40af; }
.status-result { background: #dcfce7; border-color: #bbf7d0; color: #166534; }

/* Result Tables */
#divResult, #divUtilizationResult, #divRelationshipResult { margin-top: 20px; }
table { border-collapse: collapse; width: 100%; margin-bottom: 25px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border-radius: 6px; overflow: hidden; }
th, td { border: 1px solid var(--border); padding: 10px 15px; text-align: center; font-size: 14px; }
th { background: #f8fafc; color: var(--text-main); font-weight: 600; }
h3 { margin: 25px 0 15px 0; color: var(--primary); }
h4 { margin: 15px 0 10px 0; color: var(--text-main); }
h5 { margin: 10px 0 5px 0; color: var(--text-muted); }

/* --- Added UX Enhancements --- */

/* Data Table Affordances */
table tbody tr:hover { 
    background-color: #f1f5f9; 
    transition: background-color 0.2s ease;
}
td {
    font-variant-numeric: tabular-nums;
}

/* Clear visual distinction for Structural vs Utilization inputs */
textarea#txtInputMatrix {
    border-left: 4px solid var(--primary);
}
input#txtTrajectory {
    border-left: 4px solid var(--warning);
}

/* Enhanced SVG Graph Readability */
svg {
    background: radial-gradient(circle at center, #ffffff 0%, #f8fafc 100%);
    cursor: grab;
}
svg:active {
    cursor: grabbing;
}

/* Emphasize the Proof execution button */
input[type="button"][value="Execute Mathematical Proofs"] {
    font-size: 1.1rem;
    padding: 12px 24px;
    letter-spacing: 0.5px;
    width: 100%;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}