/* 
    ODE Solver - Modern & Premium Design System
    Focus: Professional Aesthetics, Responsiveness, and Readability
*/

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #0ea5e9;
    --accent: #f43f5e;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass: rgba(255, 255, 255, 0.7);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Navigation --- */
.navbar {
    background: var(--glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted) !important;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-md);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.08);
}

/* --- Header / Hero --- */
.head {
    text-align: center;
    padding: 4rem 2rem;
    margin: 2rem 0;
    background: linear-gradient(225deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.head::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.head h1 {
    font-weight: 800;
    font-size: 2.75rem;
    margin-bottom: 1rem;
    letter-spacing: -0.05em;
}

/* --- Cards & Content --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    margin-bottom: 2rem;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--text-main);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-body {
    padding: 2rem;
}

/* --- Forms --- */
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-control {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: #fafafa;
}

.form-control:focus {
    background-color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

/* --- Math Help Section --- */
.math-help {
    background: #f1f5f9;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.math-help h5 {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

.math-help code {
    background: #e2e8f0;
    color: var(--primary-dark);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

/* --- Results & Plots --- */
.plot-container {
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.plot-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    max-height: 400px;
    margin-top: 1rem;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table thead th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid var(--border);
    font-weight: 700;
    color: var(--text-main);
    padding: 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* --- Documentation Styles --- */
.doc-sidebar {
    position: sticky;
    top: 6rem;
}

.nav-docs {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem !important;
}

.nav-docs .nav-link {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.content-section {
    padding: 2.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    scroll-margin-top: 6rem;
}

.content-section h2 {
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-section h2::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--border);
    margin-left: 1rem;
}

.content-section h3 {
    font-weight: 700;
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
    color: var(--primary);
}

.math-formula {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.badge-custom {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Responsive Helpers --- */
@media (max-width: 991.98px) {
    .doc-sidebar {
        position: static;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .head {
        padding: 2.5rem 1rem;
    }
    
    .head h1 {
        font-size: 1.875rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .table-responsive {
        max-height: 300px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Loading Area --- */
#loading {
    padding: 4rem 2rem;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-top: 2rem;
    box-shadow: var(--shadow);
    display: none;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary);
}

/* --- Tour Guide Styles --- */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1100;
}

.tour-tooltip {
    position: absolute;
    z-index: 1200;
    width: 320px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    pointer-events: auto;
}

.tour-tooltip .card-header {
    background: var(--primary) !important;
    padding: 0.75rem 1rem;
}

.tour-tooltip .card-body {
    padding: 1.25rem;
    background: white;
}

.tour-highlight {
    position: relative;
    z-index: 1150 !important;
    background: white !important;
    box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.4), 0 0 30px rgba(99, 102, 241, 0.6) !important;
    border-color: var(--primary) !important;
    pointer-events: none;
}

/* Ensure navbar is above tour overlay if needed, or adjust z-index */
.navbar {
    z-index: 1050; /* Slightly below tour elements */
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer hr {
    border-color: var(--border);
}

.footer .text-muted {
    font-size: 0.85rem;
}

.footer a.text-muted:hover {
    color: var(--primary) !important;
    transition: color 0.2s ease;
}
