:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-basic: #0ea5e9;
    --accent-advanced: #8b5cf6;
    --accent-ref: #64748b;
    --border-color: #e2e8f0;
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
}




/* Header Section styling */
.dashboard-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.search-wrapper {
    flex: 1;
    max-width: 500px;
    min-width: 280px;
}

#formulaSearch {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.3rem;
    transition: all 0.2s ease;
    outline: none;
}

#formulaSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Layout Workspace */
.dashboard-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.formula-group {
    margin-bottom: 3rem;
}

.group-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* Card Structures */
.formula-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.formula-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.badge.basic { background: #e0f2fe; color: #0369a1; }
.badge.advanced { background: #f3e8ff; color: #6b21a8; }
.badge.reference { background: #f1f5f9; color: #475569; }

.formula-display {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow-x: auto;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.advanced-math {
    justify-content: flex-start;
    font-size: 1.3rem;
}

/* SI Unit Legend Block Styling */
.unit-legend {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
}

.unit-legend h4 {
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.025em;
}

.unit-legend ul {
    list-style: none;
    padding: 0;
}

.unit-legend li {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.unit-legend li strong {
    color: var(--text-primary);
}

/* Interactive Calculator Panels */
.calculator-box {
    margin-top: auto;
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}

.instruction {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.input-group {
    margin-bottom: 0.75rem;
}

.input-grid {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.input-grid-item {
    flex: 1;
}

label {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

input[type="number"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1.3rem;
    outline: none;
    transition: border-color 0.15s ease;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
}

.calc-btn {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.calc-btn:hover {
    background: var(--primary-hover);
}

.result-display {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 500;
    background: #f8fafc;
    color: var(--text-secondary);
    border-left: 3px solid #cbd5e1;
    word-break: break-word;
}

.result-display.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-left-color: #22c55e;
}

.result-display.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-left-color: #ef4444;
}

.reference-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.dashboard-footer {
    text-align: center;
    margin-top: 4rem;
    font-size: 1rem;
    color: var(--text-secondary);
}