/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 2rem;
    color: #ffd700;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: 10px;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 120px 0 80px;
    margin-top: 80px;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-text p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 20px;
}

.btn {
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-block;
}

.btn-primary {
    background: #ffd700;
    color: #333;
}

.btn-primary:hover {
    background: #ffed4a;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255,215,0,0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
    transform: translateY(-3px);
}

/* Hero Visual */
.hero-visual {
    text-align: center;
}

.optimization-demo {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

#gradientCanvas {
    border-radius: 10px;
    background: white;
    margin-bottom: 15px;
}

.demo-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-demo {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #ffd700;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-demo:hover {
    background: #ffed4a;
    transform: translateY(-2px);
}

/* Course Overview */
.course-overview {
    padding: 80px 0;
    background: white;
}

.course-overview h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: #333;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.overview-card {
    text-align: center;
    padding: 40px 20px;
    border-radius: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.overview-card i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 20px;
}

.overview-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
}

.overview-card p {
    color: #666;
    line-height: 1.6;
}

/* Section Styles */
.section {
    padding: 80px 0;
}

.bg-light {
    background: #f8f9fa;
}

.section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: #333;
}

/* Tab System */
.content-tabs,
.application-tabs {
    max-width: 1000px;
    margin: 0 auto;
}

.tab-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    padding: 15px 30px;
    border: none;
    background: none;
    color: #666;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active,
.tab-btn:hover {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Math and Code Styling */
.math-example,
.code-example {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.math-display {
    text-align: center;
    font-size: 1.2rem;
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.code-example pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    line-height: 1.5;
}

/* Interactive Demos */
.interactive-demo,
.visual-example {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin: 30px 0;
}

.demo-container {
    text-align: center;
}

.demo-controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.demo-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.demo-controls input[type="range"] {
    width: 150px;
}

/* Algorithm Cards */
.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.algorithm-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.algorithm-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.algorithm-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.algorithm-card p {
    color: #666;
    margin-bottom: 20px;
}

.algorithm-steps ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.algorithm-steps li {
    margin-bottom: 10px;
    color: #555;
}

.algorithm-formula {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

/* Practice Section */
.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.problem-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.problem-card h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.problem-hints {
    margin: 20px 0;
}

.hint-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #ffd700;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    background: #ffed4a;
}

.hint {
    margin-top: 10px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.hint.hidden {
    display: none;
}

.solution-area textarea,
.code-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    resize: vertical;
}

.solution-area textarea:focus,
.code-input:focus {
    outline: none;
    border-color: #667eea;
}

.check-btn,
.run-code-btn {
    margin-top: 10px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background: #667eea;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.check-btn:hover,
.run-code-btn:hover {
    background: #5a67d8;
}

/* Quiz Styles */
.quiz-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.quiz-card h3 {
    color: #ffd700;
}

.quiz-options {
    margin: 20px 0;
}

.quiz-options label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.quiz-options label:hover {
    background: rgba(255,255,255,0.1);
}

.quiz-options input[type="radio"] {
    margin-right: 10px;
}

.quiz-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background: #ffd700;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-submit:hover {
    background: #ffed4a;
}

.quiz-feedback {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
}

/* Constraint Types */
.constraint-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.constraint-type {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.constraint-type h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.example {
    background: white;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-style: italic;
    color: #555;
}

/* Hyperparameter Methods */
.hyperparameter-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.method {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.method h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.pros-cons {
    margin-top: 15px;
}

.pros {
    color: #28a745;
    margin-bottom: 5px;
}

.cons {
    color: #dc3545;
}

/* Footer */
.footer {
    background: #2d3748;
    color: white;
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h4 {
    margin-bottom: 20px;
    color: #ffd700;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-links a {
    color: #a0aec0;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #ffd700;
}

.footer-bottom {
    border-top: 1px solid #4a5568;
    padding-top: 20px;
    text-align: center;
    color: #a0aec0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav {
        display: none;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-nav {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tab-btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .overview-grid,
    .algorithm-grid,
    .practice-grid {
        grid-template-columns: 1fr;
    }
    
    .constraint-types,
    .hyperparameter-methods {
        grid-template-columns: 1fr;
    }
    
    .demo-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 100px 0 60px;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 60px 0;
    }
    
    .section h2 {
        font-size: 2rem;
    }
    
    .problem-card,
    .algorithm-card,
    .overview-card {
        padding: 20px;
    }
    
    #gradientCanvas,
    #derivativeCanvas,
    #convexityCanvas,
    #regressionCanvas,
    #networkCanvas,
    #portfolioCanvas {
        max-width: 100%;
        height: auto;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}