/* --- THEME VARIABLES --- */
:root {
    --sidebar-width: 340px;
    --bg-dark: #121212;
    --bg-sidebar: #1e1e1e;
    --bg-panel: #2a2a2a;
    --text-main: #ececec;
    --text-muted: #a0a0a0;
    --accent-primary: #3b82f6; /* Modern Blue */
    --accent-hover: #2563eb;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --border: #3f3f46;
    --input-bg: #18181b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* --- LAYOUT --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- SIDEBAR --- */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    box-shadow: var(--shadow-md);
}

#sidebar.collapsed {
    transform: translateX(-100%);
    margin-right: calc(var(--sidebar-width) * -1);
}

/* Fix for layout flow when collapsed */
.app-container.sidebar-closed #sidebar {
    width: 0;
    transform: translateX(-100%);
    border: none;
}

.sidebar-header {
    padding: 12px 15px;
    background: linear-gradient(to bottom, #252525, #1e1e1e);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.sidebar-scroll-area::-webkit-scrollbar { width: 6px; }
.sidebar-scroll-area::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll-area::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* --- CONTROL PANELS --- */
.control-group {
    background-color: var(--bg-panel);
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.control-group h2 {
    margin: 0 0 8px 0;    /* CHANGED: Reduced bottom margin from 15px */
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- FORMS & INPUTS --- */
.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 10px;
}

.input-row label {
    flex: 1;
    font-size: 0.9rem;
    color: #ccc;
}

input[type="number"], input[type="text"], input[type="email"], input[type="password"], select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: white;
    padding: 5px 8px;     /* CHANGED: Slimmer inputs */
    height: 32px;         /* CHANGED: Enforce reduced height */
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus, select:focus {
    border-color: var(--accent-primary);
}

/* --- BUTTONS --- */
button {
    background-color: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

button:hover {
    background-color: #3f3f46;
}

.btn-primary {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}
.btn-primary:hover { background-color: var(--accent-hover); }

.btn-danger {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-danger);
    color: #fca5a5;
}
.btn-danger:hover { background-color: var(--accent-danger); color: white; }

.btn-icon { padding: 5px 10px; }

.full-width-btn { width: 100%; margin-top: 8px; }

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.toggle-btn:hover { color: white; background: transparent; }

/* --- MAIN CONTENT & HUD --- */
#main-content {
    flex: 1;
    position: relative;
    background-color: #000;
    overflow: hidden;
}

#visualization {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

/* Floating Menu Button */
#floatingToggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 50;
    background-color: rgba(30, 30, 30, 0.8);
    color: white;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
    box-shadow: var(--shadow-md);
}
#floatingToggle:hover { transform: scale(1.05); background-color: var(--accent-primary); border-color: var(--accent-primary); }

body:not(.sidebar-closed) #floatingToggle { opacity: 0; pointer-events: none; }
body.sidebar-closed #floatingToggle { opacity: 1; pointer-events: auto; }

/* HUD Overlay */
#sim-feedback-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    pointer-events: none;
    text-align: right;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    min-width: 180px;
}

#timerDisplay {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#status {
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Status Dot for Garmin */
.status-dot {
    height: 8px;
    width: 8px;
    background-color: #555;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.status-dot.connected { background-color: var(--accent-success); box-shadow: 0 0 8px var(--accent-success); }
.status-dot.error { background-color: var(--accent-danger); }

/* --- PREVIOUS CSS REMAINS THE SAME UNTIL HERE --- */

/* ... (Keep your existing root variables and basic layout) ... */

/* --- NEW: INSTRUCTION TEXT --- */
.instruction-text {
    color: var(--text-muted);
    margin: -5px 0 10px 0; /* CHANGED: Tighter spacing */
    font-size: 0.75rem;    /* CHANGED: Slightly smaller font */
    line-height: 1.2;
}

/* --- NEW: COMPARISON BOX --- */
.comparison-box {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
}

.comp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: #ccc;
}

.comp-val {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.diff-positive { color: var(--accent-success); } /* Faster */
.diff-negative { color: var(--accent-danger); }  /* Slower */
.diff-neutral { color: var(--text-muted); }

/* --- NEW: WELCOME OVERLAY --- */
#welcome-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.welcome-card {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 50px;
    border-radius: 16px;
    text-align: center;
    max-width: 650px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
}

.welcome-card h2 {
    color: white;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.welcome-card p {
    color: #bbb;
    line-height: 1.7;
    margin-bottom: 25px;
    font-size: 1.05rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.feature-tag {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    color: #93c5fd;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-analysis-preview {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(30, 27, 75, 0.4) 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
    padding: 20px;
    border-radius: 12px;
    margin-top: 30px;
    font-size: 0.95rem;
    color: #e9d5ff;
    text-align: left;
    line-height: 1.6;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.05);
}

.welcome-card ol {
    text-align: left;
    color: #ddd;
    line-height: 1.8;
    margin-bottom: 20px;
    padding-left: 20px;
}

/* --- UTILS --- */
#circleParams { display: none; } /* Hide circle inputs by default for cleaner UI */

/* --- TABS --- */
.tab-container {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.tab-btn:hover { color: white; }
.tab-btn.active {
    color: var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
    font-weight: bold;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- PRIVACY NOTE --- */
.privacy-note {
    font-size: 0.75rem;
    color: #999;
    background: rgba(16, 185, 129, 0.1); /* Green tint */
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    line-height: 1.3;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.privacy-note i { color: var(--accent-success); margin-top: 2px; }

/* --- UPLOAD AREA --- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 30px 10px;
    text-align: center;
    cursor: pointer;
    background: rgba(0,0,0,0.2);
    transition: all 0.2s;
}
.upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}
/* Add to bottom of style.css */
.pace-input {
    font-family: 'Courier New', monospace; /* Keeps numbers aligned */
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center; /* Center the time (e.g., 8:30) */
    font-size: 1rem;
}
/* --- SCROLLABLE PACES --- */
.pace-scroll-container {
    max-height: 200px;      /* Takes up limited vertical space */
    overflow-y: auto;       /* Adds scrollbar if more than ~5 miles */
    padding-right: 5px;     /* Space for scrollbar */
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.pace-scroll-container::-webkit-scrollbar { width: 4px; }
.pace-scroll-container::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.pace-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.85rem;
}
.pace-row label { color: #aaa; flex: 1; }
.pace-row input { width: 80px; text-align: center; font-family: 'Courier New', monospace; }

/* --- STRATEGY CARD --- */
.strategy-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 0;
    font-size: 0.9rem;
}
.btn-icon-small:hover { color: white; }
/* --- AI Sparkle Feedback --- */
@keyframes sparkle-shine {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.sparkle-feedback {
    background: linear-gradient(to right, #FFD700 20%, #FFF 40%, #FFD700 60%, #FFF 80%);
    background-size: 200% auto;
    color: #FFD700;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 1.5rem;
    text-align: center;
    animation: sparkle-shine 3s linear infinite;
    display: block;
    margin-top: 15px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
    line-height: 1.4;
}

.btn-ai-action {
    background: linear-gradient(45deg, #6b21a8, #a855f7);
    border: none;
    color: white;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-ai-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
    color: white;
}

/* Placeholder text styling for better visibility */
input::placeholder { /* Standard syntax */
    color: #888; /* Lighter grey for better contrast */
    opacity: 1; /* Ensure full opacity */
}
input::-webkit-input-placeholder { /* WebKit browsers */
    color: #888;
}
input:-ms-input-placeholder { /* Internet Explorer 10-11 */
    color: #888;
}
input::-ms-input-placeholder { /* Microsoft Edge */
    color: #888;
}

/* Password Toggle Wrapper */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 35px; /* Make room for the eye icon */
}

#togglePassword {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #888;
    cursor: pointer;
    z-index: 10;
    font-size: 0.9rem;
    transition: color 0.2s;
}

#togglePassword:hover {
    color: var(--accent-primary);
}
