:root {
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.5);
    --secondary: #f472b6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-x: #fbbf24;
    --accent-c: #a78bfa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(244, 114, 182, 0.1) 0%, transparent 40%);
    z-index: -1;
}

header {
    padding: 2rem;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #38bdf8, #818cf8, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.app-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    padding: 0 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.eqn-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.eqn-btn:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.eqn-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    font-weight: 700;
    box-shadow: 0 0 15px var(--primary-glow);
}

.data-display {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.data-point {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 1rem;
    text-align: center;
}

.label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 1rem;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn.primary:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Display Section */
.display-section {
    display: flex;
    flex-direction: column;
}

.main-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 500px;
}

.equation-view {
    text-align: center;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

#equation-text {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.highlight-x {
    color: var(--accent-x);
}

.highlight-c {
    color: var(--accent-c);
}

#canvas-container {
    flex: 2;
    /* Take more space */
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.values-table-container {
    flex: 1;
    /* Take less space */
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.table-wrapper {
    flex: 1;
    margin-top: 0.5rem;
    border-radius: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

th {
    position: sticky;
    top: 0;
    background: var(--bg-dark);
    color: var(--primary);
    padding: 0.75rem;
    text-align: center;
    border-bottom: 2px solid var(--card-border);
}

td {
    padding: 0.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.graph-display-row {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 400px;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.graph-footer {
    margin-top: 1rem;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    color: var(--bg-dark);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    font-style: normal;
}

@media (max-width: 1000px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .display-section {
        order: 1;
    }
}