:root {
    --primary-color: #064863;
    --primary-light: #3b82f6;
    --primary-dark: #157299;
    --background-color: #f8fafc;
    --text-color: #334155;
    --light-gray: #e2e8f0;
    --white: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo i {
    font-size: 1.6rem;
}

.logo h1 {
    font-size: 1.3rem;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.main-nav a:hover {
    opacity: 1;
}

main {
    padding: 2rem 1rem;
    max-width: 960px;
    margin: 0 auto;
}

.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2.2rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.physics-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.input-section, .output-section {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--light-gray);
}

.section-title {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #475569;
}

.form-group textarea {
    min-height: 120px;
    padding: 0.8rem;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    resize: vertical;
    font-size: 1rem;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.style-options {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f8fafc;
    border: 1px solid var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-label:hover {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.upload-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background-color: #f1f5f9;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-label:hover {
    background-color: #e2e8f0;
    border-color: var(--primary-color);
}

#image_upload {
    display: none;
}

.preview-container {
    display: none;
    margin-top: 1rem;
}

.preview-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

.btn {
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-dark);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.btn:hover {
    background-color: var(--primary-color);
}

.btn:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.sample-questions-container {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--light-gray);
}

.sample-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #475569;
}

.sample-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sample-question {
    background-color: #eef2ff;
    color: #157299;
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sample-question:hover {
    background-color: #e0e7ff;
}

.output-content {
    min-height: 200px;
    padding: 0.5rem;
    background-color: #f8fafc;
    border-radius: 8px;
}

#outputResult {
    line-height: 2;
    font-size: 1.05rem;
}

#outputResult strong {
    color: var(--primary-dark);
    font-weight: 700;
}

#outputResult .katex-display {
    margin: 1rem 0;
}

.output-placeholder {
    color: #94a3b8;
    text-align: center;
    padding: 2rem;
}

.loading {
    display: none;
    text-align: center;
    padding: 1rem;
}

.loading-spinner {
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background-color: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
    padding: 1rem;
    border-radius: 8px;
}

.section-heading {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 2.5rem;
    font-weight: 600;
}

/* How It Works Section Styling */
.how-it-works-section {
    padding: 2.5rem; /* Padding a-chha kiya */
    margin-top: 3rem;
    background-color: var(--white); /* White background */
    border-radius: 12px; /* Curved corners */
    box-shadow: var(--shadow); /* Halka shadow */
    border: 1px solid var(--light-gray); /* Halka border */
}

.steps-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

/* Timeline ki vertical line banane ke liye */
.steps-container::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 1rem;
    bottom: 1rem;
    width: 3px;
    background-color: #e2e8f0; /* Light gray line */
    border-radius: 2px;
    z-index: 1;
}

.step-item {
    display: flex;
    align-items: flex-start; /* Icons ko top se align rakhega */
    gap: 1.5rem;
    position: relative;
    background-color: transparent; /* Step item ka background hata diya */
    border: none;
    padding: 0;
    box-shadow: none;
}

.step-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    z-index: 2; /* Line ke upar dikhane ke liye */
    border: 4px solid var(--white); /* Background se match karne wala border */
}

.step-content h3 {
    font-size: 1.3rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.step-content p {
    color: var(--text-color);
    line-height: 1.7;
}

/* Why Choose Us Section */
.features-section {
    padding: 3rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--light-gray);
}

.features-grid {
    display: grid;
    gap: 2rem;
    text-align: center;
    grid-template-columns: 1fr;
}

.feature-box {
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}

.feature-box i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-box h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* Final About/Features Section */
.about-section {
    padding: 3rem 1.5rem;
    margin-top: 1rem;
    background-color: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
}

.about-section .about-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2.5rem auto;
}

.about-section p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #475569;
}

.about-section p strong {
    color: inherit;
    font-weight: 600;
}

.about-section .about-features-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    text-align: left;
}

.about-section .about-features-list h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

/* Footer */
footer {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    margin-top: 3rem;
    color: #64748b;
    font-size: 0.9rem;
}

.footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copyright p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #1e293b;
}

/* Responsive Media Queries */
@media (min-width: 769px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-nav { display: none; }
    .hero h2 { font-size: 1.8rem; }
    .section-heading { font-size: 1.5rem; }
    .features-section, .about-section, .input-section, .output-section, .how-it-works-section { padding: 1.5rem 1rem; }
    .footer-bar { flex-direction: column; gap: 0.8rem; }
}