:root {
    --primary-bg: #0a0a1a;
    --secondary-bg: #12122a;
    --accent-blue: #2563eb;
    --light-blue: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #1e293b;
    --card-bg: #1a1b2e;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

header {
    background: linear-gradient(135deg, var(--secondary-bg), var(--accent-blue));
    color: var(--text-primary);
    text-align: center;
    padding: 1.5rem 0;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

.back-btn {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
    background-color: rgba(255, 255, 255, 0.1);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.formula-generator-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.formula-selection, .formula-inputs, .formula-result, .formula-examples, .how-to-use {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

h2 {
    color: var(--light-blue);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

h3 {
    color: var(--light-blue);
    margin-bottom: 0.5rem;
}

select {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.instruction {
    color: var(--text-secondary);
    font-style: italic;
}

.result-box {
    background: var(--secondary-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    min-height: 60px;
    color: var(--light-blue);
    border: 1px solid var(--border-color);
}

button {
    background: linear-gradient(135deg, var(--accent-blue), var(--light-blue));
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

button:hover {
    background: linear-gradient(135deg, var(--light-blue), var(--accent-blue));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

#copy-btn {
    width: 100%;
}

.examples-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.example {
    background: var(--secondary-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.example h3 {
    color: var(--light-blue);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.example p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.example p:first-of-type {
    font-family: 'Courier New', Courier, monospace;
    color: var(--light-blue);
    font-weight: 600;
}

/* How to Use Section */
.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.step {
    background: var(--secondary-bg);
    padding: 1.2rem;
    border-radius: 8px;
    position: relative;
    border: 1px solid var(--border-color);
}

.step-number {
    display: inline-block;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--accent-blue), var(--light-blue));
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 26px;
    font-weight: bold;
    margin-right: 8px;
}

.toggle-details {
    background: transparent;
    color: var(--accent-blue);
    border: 2px solid var(--accent-blue);
    margin: 0 auto;
    display: block;
    width: auto;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s;
}

.toggle-details:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: none;
    box-shadow: none;
}

.detailed-instructions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    margin-top: 1rem;
}

.detailed-instructions.show {
    max-height: 500px;
}

.detailed-instructions h3 {
    color: var(--light-blue);
    margin-bottom: 0.5rem;
}

.detailed-instructions ul {
    padding-left: 1.2rem;
    color: var(--text-secondary);
}

.detailed-instructions li {
    margin-bottom: 0.5rem;
}

.detailed-instructions code {
    background: var(--secondary-bg);
    color: var(--light-blue);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.formula-description {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .examples-container {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .steps-container {
        grid-template-columns: 1fr;
    }
}