/* Colorblind-friendly design system with high contrast and accessibility focus */

:root {
    --background: hsl(0, 0%, 98%);
    --foreground: hsl(220, 15%, 15%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(220, 15%, 15%);
    --primary: hsl(220, 85%, 25%);
    --primary-foreground: hsl(0, 0%, 98%);
    --primary-light: hsl(220, 75%, 45%);
    --secondary: hsl(25, 85%, 45%);
    --secondary-foreground: hsl(0, 0%, 98%);
    --tertiary: hsl(260, 70%, 40%);
    --accent: hsl(45, 95%, 50%);
    --muted: hsl(220, 10%, 90%);
    --muted-foreground: hsl(220, 15%, 35%);
    --border: hsl(220, 15%, 85%);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 0.75rem;
    --sidebar-width: 250px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    display: flex; /* Sidebar Layout */
    min-height: 100vh;
}

/* --- PATTERN: SIDEBAR NAVIGATION [cite: 34] --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary);
    color: var(--primary-foreground);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 3rem;
    text-align: center;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Miller's Law: Distinct separation */
}

.nav-link {
    text-decoration: none;
    color: #cbd5e1;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: block;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 4px solid var(--accent);
}

/* Main Content Area Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem;
}

/* --- PATTERN: TOOLTIPS  --- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- PATTERN: MASTER-DETAIL [cite: 16] --- */
/* Specific for Visualizations Page */
.master-detail-container {
    display: flex;
    gap: 2rem;
    height: calc(100vh - 150px); /* Fit within view */
}

.master-list {
    flex: 0 0 30%; /* 30% width for Master */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.master-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.master-item:hover { background-color: var(--muted); }
.master-item.active-item { 
    background-color: var(--primary-light); 
    color: white; 
    border-radius: 4px;
}

.detail-view {
    flex: 1; /* Remainder for Detail */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.chart-panel { display: none; } /* Hidden by default */
.chart-panel.active-panel { display: block; animation: fadeIn 0.5s; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-title, .page-subtitle, .hero-title, .hero-subtitle {
    text-align: center;
}

/* --- PATTERN: DASHBOARD & CHUNKING [cite: 99, 113] --- */
.container { max-width: 1400px; margin: 0 auto; }
.features-grid, .resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.feature-title, .chart-title, .resource-title {
    color: var(--primary);
}
.resource-link {
    text-decoration: none;
    color: inherit;
}
.bar-label, .pie-label, .chart-legend, .hist-labels {
    font-weight: 600;
}
.bar-value {
    color: black;
}
.color-box {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--foreground);
    border-radius: 4px;
}
.color-primary {
    background-color: var(--primary);
}

.color-secondary {
    background-color: var(--secondary);
}

.color-tertiary {
    background-color: var(--tertiary);
}

.color-accent {
    background-color: var(--accent);
}

.download-link {
    text-align: center;
}
.card-style {
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Existing Visual styles from your code (Preserved) */
.pattern-dots { background-image: radial-gradient(circle, currentColor 2px, transparent 2px); background-size: 12px 12px; }
.pattern-lines { background-image: repeating-linear-gradient(45deg, currentColor, currentColor 2px, transparent 2px, transparent 8px); }
.pattern-grid { background-image: linear-gradient(currentColor 1px, transparent 1px), linear-gradient(90deg, currentColor 1px, transparent 1px); background-size: 20px 20px; }
.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;     
  object-fit: cover;       
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}
.gallery-grid img:hover {
  transform: scale(1.05);
}
/* Form Chunking */
.contact-form { max-width: 600px; margin: 0 auto; }
.form-group { margin-bottom: 1.5rem; } /* Spacing for Miller's Law */
input, select, textarea { width: 100%; padding: 0.8rem; margin-top: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.styled-btn { background: var(--primary); color: white; padding: 0.8rem 1.5rem; border: none; border-radius: var(--radius); cursor: pointer; }
.styled-btn:hover {
  background-color: var(--primary-light);
  transform: scale(1.05);
}
/* Chart Specifics (Preserved) */
.bar-chart, .pie-chart, .histogram, .circle-pie { margin-top: 1rem; }
.bar-container, .pie-bar { background: var(--muted); border-radius: 4px; height: 2rem; overflow: hidden; margin-bottom: 1rem; }
.bar, .pie-fill { height: 100%; transition: width 1s ease; border: 2px solid #333; }
.bar-primary { background-color: var(--primary); color: white; }
.bar-secondary { background-color: var(--secondary); color: white; }
.bar-tertiary { background-color: var(--tertiary); color: white; }
.bar-accent { background-color: var(--accent); color: black; }
.circle-pie { width: 200px; height: 200px; border-radius: 50%; background: conic-gradient(var(--c1) 0% 40%, var(--c2) 40% 70%, var(--c3) 70% 90%, var(--c4) 90% 100%); margin: 2rem auto; }
.histogram { display: flex; align-items: flex-end; height: 200px; gap: 10px; }
.hist-bar { flex: 1; border-radius: 4px 4px 0 0; border: 1px solid #333; }
.hist-labels { display: flex; justify-content: space-between; margin-top: 10px; }

/* Responsive */
@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; justify-content: space-between; padding: 1rem; }
    .nav-menu { flex-direction: row; gap: 10px; display: none; } /* Hamburger logic needed for mobile, but simplified here */
    .main-wrapper { margin-left: 0; width: 100%; }
    .master-detail-container { flex-direction: column; height: auto; }

}

