/* Mathematics Courses CSS - Inspired by Khan Academy & Brilliant.org */
/* Enhanced visual design for mathematical content */

:root {
    --math-primary: #1a73e8;
    --math-secondary: #34a853;
    --math-accent: #ea4335;
    --math-purple: #8e24aa;
    --math-orange: #ff6f00;
    --math-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --math-bg-light: #f8f9fa;
    --math-bg-card: #ffffff;
    --math-text-dark: #202124;
    --math-text-light: #5f6368;
    --math-border: #dadce0;
    --math-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --math-shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

/* Base Styles */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--math-text-dark);
    background: var(--math-bg-light);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
}

/* Responsive padding for content */
@media (max-width: 1024px) {
    .container {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
}

/* Header Styles */
.math-header {
    background: var(--math-gradient);
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: var(--math-shadow);
}

.math-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.math-header p {
    margin: 0;
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Search Container */
.search-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--math-shadow);
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--math-border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--math-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.search-container button {
    padding: 12px 20px;
    background: var(--math-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.search-container button:hover {
    background: #1557b0;
}

/* DTree Styles Enhancement */
.dtree {
    background: white;
    border-radius: 12px;
    box-shadow: var(--math-shadow);
    padding: 20px;
    margin: 20px 0;
}

.dtree a {
    color: var(--math-primary) !important;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 2px 0;
}

.dtree a:hover {
    background: rgba(26, 115, 232, 0.1);
    color: #1557b0 !important;
    transform: translateX(5px);
}

.dtree a.nodeSel {
    background: var(--math-primary);
    color: white !important;
    font-weight: 500;
}

/* Featured Section */
.featured-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--math-shadow);
    padding: 30px;
    margin-top: 30px;
}

.featured-section h2 {
    color: var(--math-text-dark);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.interactive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.interactive-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.interactive-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--math-shadow-hover);
    border-color: var(--math-primary);
}

.interactive-card h3 {
    color: var(--math-text-dark);
    margin: 0 0 10px 0;
    font-size: 1.4rem;
}

.interactive-card p {
    color: var(--math-text-light);
    margin: 0 0 20px 0;
    font-size: 1rem;
}

.interactive-card button {
    background: var(--math-secondary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.interactive-card button:hover {
    background: #2e7d32;
}

/* Math Content Styles */
.math-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--math-shadow);
    padding: 30px;
    margin: 20px 0;
}

.math-section {
    margin-bottom: 40px;
}

.math-section h2 {
    color: var(--math-primary);
    border-bottom: 3px solid var(--math-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Formula Display */
.formula-box {
    background: #f8f9fd;
    border: 2px solid #e3f2fd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.formula-box .katex {
    font-size: 1.3em;
}

/* Interactive Elements */
.graph-container {
    background: white;
    border: 2px solid var(--math-border);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 300px;
}

.equation-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--math-border);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    margin: 10px 0;
}

.equation-input:focus {
    outline: none;
    border-color: var(--math-primary);
}

/* Button Styles */
.btn-primary {
    background: var(--math-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #1557b0;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: var(--math-text-dark);
    border: 2px solid var(--math-border);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--math-text-dark);
    color: white;
    border-color: var(--math-text-dark);
}

/* Exercise Styles */
.exercise-card {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ffcc80;
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    position: relative;
}

.exercise-card::before {
    content: "📝";
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
}

.exercise-card h3 {
    color: #e65100;
    margin-top: 0;
}

.exercise-solution {
    background: #e8f5e9;
    border: 2px solid #81c784;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .math-header h1 {
        font-size: 2.2rem;
    }

    .interactive-grid {
        grid-template-columns: 1fr;
    }

    .search-container {
        flex-direction: column;
        align-items: stretch;
    }

    .container {
        padding: 15px;
    }

    .math-content {
        padding: 20px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--math-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
}

.message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

.message.info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #42a5f5;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--math-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1557b0;
}
