/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Colors - Dark Professional Theme */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #252525;

    --accent-primary: #00ff9d;
    /* Cyber Green */
    --accent-secondary: #2ecc71;
    /* Slightly darker green */
    --accent-hover: #00cc7d;

    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-dark: #121212;

    --border-color: #333333;
    --input-bg: #2a2a2a;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --glow-accent: 0 0 10px rgba(0, 255, 157, 0.2);

    /* Typography */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* =========================================
   2. LAYOUT & CONTAINERS
   ========================================= */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.header-image-wrap {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 12px auto;
    padding: 0;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: transparent;
    overflow: hidden;
}

.header-image {
    display: block;
    max-width: 100%;
    max-height: 300px;   /* adjust if needed */
    width: auto;
    height: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent-primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.logo .version {
    font-size: 0.8rem;
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-secondary);
}

/* Controls Section */
.controls-section {
    display: flex;
    justify-content: flex-start;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    #right-panel {
        order: -1;
        /* Show visual first on mobile/tablet ? Optional, but usually good */
    }
}

/* Panels */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.panel-title {
    font-size: 1.1rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
}

/* =========================================
   3. COMPONENTS
   ========================================= */

/* Site Type Switch - 3D Implementation */
.switch-container {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    /* Inset shadow for depth */
}

.switch-label-text {
    font-weight: 600;
    color: var(--text-muted);
}

.switch {
    display: flex;
    align-items: center;
    background: #000;
    /* Dark track */
    border-radius: 30px;
    position: relative;
    height: 40px;
    width: 260px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05);
    /* Deep track look */
    padding: 0 4px;
}

.switch input {
    display: none;
}

.switch-label {
    flex: 1;
    text-align: center;
    z-index: 2;
    /* Sit above glider */
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
    user-select: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Glider (The 3D Button) */
.glider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: 32px;
    width: calc(50% - 4px);
    background: var(--accent-primary);
    border-radius: 24px;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy spring effect */
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.4),
        /* Drop shadow */
        inset 0 2px 2px rgba(255, 255, 255, 0.4),
        /* Top highlight (lighting) */
        inset 0 -2px 2px rgba(0, 0, 0, 0.2);
    /* Bottom shadow (rounding) */
}

/* Logic to move glider */
/* Default (first input checked) -> Glider at position 0 */
/* If second input is checked -> Move Glider */
.switch input#small:checked~.glider {
    transform: translateX(100%);
}

/* Text Colors based on selection */
.switch input#macro:checked+label {
    color: var(--text-dark);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.switch input#small:checked+label {
    color: var(--text-dark);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Hover effects */
.switch:hover .glider {
    filter: brightness(1.1);
}

/* Parameters Inputs */
.parameters-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-group input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.1);
}

/* Calculate Button */
.calc-wrapper {
    margin-top: 30px;
    width: 100%;
}

.calc-link {
    width: 100%;
    height: 50px;
    position: relative;
    cursor: pointer;
}

.calc-link span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--accent-primary);
    color: var(--text-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: absolute;
    z-index: 2;
    box-shadow: var(--glow-accent);
}

.calc-icon {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    opacity: 0;
    transition: all 0.3s ease;
    transform: translateX(-20px);
}

.calc-icon svg {
    fill: var(--accent-primary);
    width: 24px;
    height: 24px;
}

.calc-wrapper:hover .calc-link span {
    transform: translateX(-10px);
    width: calc(100% - 50px);
}

.calc-wrapper:hover .calc-icon {
    opacity: 1;
    transform: translateX(0);
}

/* Results */
.results-container {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    min-height: 100px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

#results div {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

#results div:last-child {
    border-bottom: none;
}

/* Visualization (Canvas) */
.canvas-wrapper {
    background: #fff;
    /* Canvas needs white bg for the drawings as logic uses white */
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    max-width: 100%;
    height: auto;
}

/* Readme / Info Panel */
.info-panel {
    margin-bottom: 40px;
}

.info-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media(max-width: 768px) {
    .info-content {
        grid-template-columns: 1fr;
    }
}

.info-item {
    padding: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.info-item h4 {
    color: var(--text-main);
    margin-bottom: 10px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.info-item strong {
    color: var(--accent-primary);
}


/* Readability Overrides for Generated Result Text 
   The JS generates inline styles with standard colors (blue, red, green).
   These are hard to read on a dark background, so we brighten them.
*/
#results div[style*="color:blue"] {
    color: #64b5f6 !important;
    /* Lighter Blue */
}

#results div[style*="color:red"] {
    color: #ff8a80 !important;
    /* Lighter Red/Salmon */
}

#results div[style*="color:green"] {
    color: #69f0ae !important;
    /* Bright Green */
}
