:root {
    --bg-main: #0B0F19;
    --bg-panel: #1A1F2C;
    --bg-card: #252A36;
    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;
    --accent: #10B981;
    --accent-hover: #059669;
    --border: #374151;
    --danger: #EF4444;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body { background-color: var(--bg-main); color: var(--text-main); height: 100vh; overflow: hidden; }
.app-container { display: flex; height: 100vh; }

/* Login Screen Styling */
.login-wrapper {
    display: flex; align-items: center; justify-content: center; height: 100vh;
    background: radial-gradient(circle at center, #1A1F2C 0%, #0B0F19 100%); width: 100%;
}
.login-box {
    background: var(--bg-card); padding: 40px; border-radius: var(--radius-lg);
    border: 1px solid var(--border); width: 100%; max-width: 420px; text-align: center;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }
.login-box h2 { font-size: 1.5rem; margin-bottom: 8px; }
.login-subtext { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 20px; text-align: left; }
.login-input-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.login-input-group input {
    width: 100%; background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main);
    padding: 12px 16px; border-radius: var(--radius-md); outline: none; font-size: 1rem;
}
.login-input-group input:focus { border-color: var(--accent); }
.login-btn {
    background: var(--accent); color: white; border: none; padding: 14px; border-radius: var(--radius-md);
    font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.login-btn:hover { background: var(--accent-hover); }

/* Left Navigation Sidebar */
.sidebar-nav {
    width: 80px; background-color: var(--bg-panel); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; padding: 24px 0; z-index: 20;
}
.nav-brand { margin-bottom: 40px; }
.nav-links { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.icon-btn {
    background: transparent; border: none; color: var(--text-muted); padding: 12px;
    border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s;
}
.icon-btn:hover { color: var(--text-main); background: var(--bg-card); }
.icon-btn.active { color: var(--accent); background: rgba(16, 185, 129, 0.1); }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem;}

/* Main Content Area */
.main-content { flex: 1; position: relative; display: flex; flex-direction: column; overflow: hidden; }
.view-section { height: 100%; width: 100%; display: flex; flex-direction: column; }
#view-estimator { flex-direction: row; }

/* Dashboard UI */
.dashboard-header-bar { padding: 32px 40px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.sub-text { color: var(--text-muted); margin-top: 4px; }
.action-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); padding: 10px 20px; border-radius: var(--radius-md); cursor: pointer; font-weight: 500; transition: background 0.2s; }
.action-btn:hover { background: var(--border); }
.action-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.action-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.dashboard-stats { display: flex; gap: 24px; padding: 32px 40px 0; }
.stat-card { flex: 1; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; }
.stat-title { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-main); }
.text-green { color: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; padding: 32px 40px; flex: 1; overflow-y: auto; }
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card h3 { margin-bottom: 24px; font-size: 1.1rem; color: var(--text-muted); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { font-size: 0.95rem; }
.text-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-weight: 500; }
.status-badge { font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; }
.status-badge.manufacturing { background: rgba(59, 130, 246, 0.2); color: #60A5FA; }
.status-badge.design { background: rgba(245, 158, 11, 0.2); color: #FBBF24; }

/* Timeline Tracker */
.timeline { display: flex; flex-direction: column; gap: 24px; }
.timeline-item { display: flex; gap: 16px; position: relative; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 7px; top: 20px; bottom: -24px; width: 2px; background: var(--border); }
.timeline-item.completed:not(:last-child)::before { background: var(--accent); }
.node { width: 16px; height: 16px; border-radius: 50%; background: var(--bg-main); border: 2px solid var(--border); z-index: 1; margin-top: 4px; }
.timeline-item.completed .node, .timeline-item.active .node { border-color: var(--accent); }
.timeline-item.completed .node { background: var(--accent); }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
.timeline-item .content h4 { color: var(--text-muted); margin-bottom: 4px; }
.timeline-item.completed .content h4, .timeline-item.active .content h4 { color: var(--text-main); }
.timeline-item .content p { font-size: 0.85rem; color: var(--text-muted); }

/* Estimator Wizard */
.wizard-sidebar { width: 380px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 10; }
.wizard-header { padding: 32px 24px 24px; border-bottom: 1px solid var(--border); }
.wizard-header h2 { font-size: 1.25rem; margin-bottom: 4px; }
.wizard-header p { color: var(--text-muted); font-size: 0.85rem; }

/* Stepper */
.step-indicator { display: flex; padding: 20px 24px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.step { display: flex; flex-direction: column; align-items: center; gap: 8px; opacity: 0.5; transition: opacity 0.3s; }
.step.active { opacity: 1; }
.step.completed { opacity: 1; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; }
.step.active .step-num { background: var(--accent); color: white; }
.step.completed .step-num { background: var(--accent); color: white; }
.step span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
.step-line { height: 2px; flex: 1; background: var(--border); margin: 0 10px 18px; }
.step.completed + .step-line { background: var(--accent); }

/* Wizard Steps */
.wizard-content { flex: 1; position: relative; padding: 24px; overflow-y: auto; }
.wizard-step { display: none; animation: fadeIn 0.3s ease-in-out; }
.wizard-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

.wizard-step h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-main); }
.step-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; line-height: 1.5; }

/* Form Controls */
.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.search-box { display: flex; background: var(--bg-main); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.search-box input { flex: 1; background: transparent; border: none; color: var(--text-main); padding: 12px 16px; outline: none; }
.search-box button { background: var(--accent); color: #fff; border: none; padding: 0 16px; cursor: pointer; transition: background 0.2s; }
.search-box button:hover { background: var(--accent-hover); }

.config-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 0.95rem; }
select { background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main); padding: 8px 12px; border-radius: 4px; outline: none; width: 150px; }
.toggle-group { display: flex; background: var(--bg-main); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.toggle-btn { background: transparent; border: none; color: var(--text-muted); padding: 8px 16px; cursor: pointer; }
.toggle-btn.active { background: var(--bg-card); color: var(--text-main); }

/* Cost Panel */
.cost-panel { background: var(--bg-main); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--border); }
.cost-metric { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.cost-metric span:last-child { color: var(--text-main); font-weight: 500; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.cost-total { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; font-weight: 600; }
.cost-total span:last-child { font-size: 1.5rem; color: var(--accent); }

.mt-3 { margin-top: 24px; }
.mt-2 { margin-top: 12px; }
.savings-card { background: rgba(239, 68, 68, 0.05); border-left: 3px solid var(--danger); padding: 12px; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 0.85rem; }
.savings-title { color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }
.savings-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bad-metric { color: var(--danger); }
.good-metric { color: var(--accent); font-weight: 600; }

.wizard-footer { padding: 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; }

/* Map Area */
.map-container { flex: 1; position: relative; }
#map { height: 100%; width: 100%; z-index: 1; }
.leaflet-container { background: #0f131a; }
.leaflet-layer, .leaflet-control-zoom-in, .leaflet-control-zoom-out, .leaflet-control-attribution { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }
#roundabout-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none; opacity: 0; transition: opacity 0.5s ease-in-out; }
#roundabout-overlay.visible { opacity: 1; }

.map-hint {
    position: absolute; top: 32px; left: 50%; transform: translateX(-50%);
    background: var(--bg-panel); padding: 12px 24px; border-radius: 30px;
    border: 1px solid var(--accent); color: var(--text-main); font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 10; transition: opacity 0.3s;
}

/* Quick Select Badges */
.quick-select { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.quick-badge { background: rgba(16, 185, 129, 0.1); color: var(--accent); padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; cursor: pointer; border: 1px solid transparent; transition: all 0.2s; }
.quick-badge:hover { background: rgba(16, 185, 129, 0.2); border-color: var(--accent); }

/* Range Slider */
input[type=range] { -webkit-appearance: none; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; margin-top: -6px; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: var(--border); border-radius: 2px; }
input[type=range]:focus { outline: none; }
