/* ==========================================
   CSS RESET
========================================== */

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

/* ==========================================
   DESIGN TOKENS
========================================== */

:root {

    /* Colors */

    --primary: #2563eb;
    --primary-hover: #1d4ed8;

    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;

    --bg: #f8fafc;
    --surface: #ffffff;

    --text: #0f172a;
    --text-secondary: #475569;

    --border: #e2e8f0;

    /* Radius */

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    /* Shadows */

    --shadow-sm:
        0 4px 10px rgba(0, 0, 0, 0.08);

    --shadow-md:
        0 12px 30px rgba(0, 0, 0, 0.12);

    /* Typography */

    --font-family:
        Inter,
        Segoe UI,
        Roboto,
        sans-serif;

    /* Spacing */

    --space-xs: .25rem;
    --space-sm: .5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Animation */

    --transition: 0.25s ease;
}

/* ==========================================
   BASE
========================================== */

html {
    scroll-behavior: smooth;
}

body {

    font-family: var(--font-family);

    background: var(--bg);

    color: var(--text);

    min-height: 100vh;

    transition: var(--transition);
}

button,
select,
input {

    font: inherit;
}

/* ==========================================
   HEADER
========================================== */

.app-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1rem;

    padding: 1rem 2rem;

    background: var(--surface);

    border-bottom: 1px solid var(--border);

    box-shadow: var(--shadow-sm);

    position: sticky;

    top: 0;

    z-index: 100;
}

.logo-section h1 {

    font-size: 1.6rem;
}

.logo-section p {

    color: var(--text-secondary);

    margin-top: 4px;
}

.header-actions {

    display: flex;

    gap: .75rem;

    flex-wrap: wrap;
}

/* ==========================================
   BUTTONS
========================================== */

button {

    border: none;

    cursor: pointer;

    border-radius: var(--radius-sm);

    transition: var(--transition);
}

.tab-btn,
.dark-mode-btn {

    padding: .75rem 1rem;

    background: var(--surface);

    border: 1px solid var(--border);
}

.tab-btn:hover,
.dark-mode-btn:hover {

    transform: translateY(-2px);
}

.tab-btn.active {

    background: var(--primary);

    color: white;
}

/* ==========================================
   MAIN LAYOUT
========================================== */

.main-layout {

    padding: 1.5rem;

    max-width: 1600px;

    margin: auto;
}

.module-section {

    display: none;

    gap: 1.5rem;
}

.active-module {

    display: grid;

    grid-template-columns:
        280px
        minmax(0, 1fr)
        300px;

    align-items: start;
}

/* ==========================================
   PANELS
========================================== */

.controls-panel,
.visualization-panel,
.info-panel {

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);

    padding: 1rem;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.controls-panel:hover,
.visualization-panel:hover,
.info-panel:hover {

    transform: translateY(-2px);

    box-shadow: var(--shadow-md);
}

.controls-panel h2,
.info-panel h2 {

    margin-bottom: 1rem;
}

/* ==========================================
   VISUALIZATION PANEL
========================================== */

.visualization-panel {

    min-width: 0;

    overflow: hidden;
}

/* ==========================================
   CONTROLS
========================================== */

.control-group {

    display: flex;

    flex-direction: column;

    gap: .5rem;

    margin-bottom: 1rem;
}

.control-group label {

    font-weight: 600;

    color: var(--text-secondary);
}

select,
input[type="range"] {

    width: 100%;
}

.button-grid {

    display: grid;

    gap: .75rem;
}

.button-grid button {

    background: var(--primary);

    color: white;

    padding: .8rem;
}

.button-grid button:hover {

    background: var(--primary-hover);

    transform: translateY(-2px);
}

/* ==========================================
   INFO PANEL
========================================== */

.info-card {

    display: flex;

    flex-direction: column;

    gap: .8rem;

    padding: 1rem;

    border-radius: var(--radius-sm);

    background: var(--surface);

    border: 1px solid var(--border);
}

.info-card h3 {

    color: var(--primary);

    font-size: 1.2rem;
}

.info-item {

    display: flex;

    justify-content: space-between;

    gap: 1rem;
}

/* ==========================================
   TABLET
========================================== */

@media (max-width: 1023px) {

    .active-module {

        display: flex;

        flex-direction: column;
    }

    .visualization-panel {

        min-height: 500px;
    }

    .controls-panel,
    .info-panel {

        width: 100%;
    }

    .button-grid {

        grid-template-columns:
            repeat(2, 1fr);
    }
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 767px) {

    .app-header {

        flex-direction: column;

        align-items: stretch;

        text-align: center;
    }

    .header-actions {

        width: 100%;

        display: grid;

        grid-template-columns: 1fr;
    }

    .header-actions button {

        width: 100%;
    }

    .main-layout {

        padding: 0.75rem;
    }

    .controls-panel,
    .visualization-panel,
    .info-panel {

        padding: 0.75rem;
    }

    .button-grid {

        grid-template-columns: 1fr;
    }

    .info-item {

        flex-direction: column;

        gap: 0.25rem;
    }

    .logo-section h1 {

        font-size: 1.4rem;
    }

    .controls-panel:hover,
    .visualization-panel:hover,
    .info-panel:hover {

        transform: none;
    }
}

/* ==========================================
   SMALL MOBILE
========================================== */

@media (max-width: 480px) {

    .main-layout {

        padding: 0.5rem;
    }

    .controls-panel h2,
    .info-panel h2 {

        font-size: 1.1rem;
    }
}