/* 
 * Integral Calculator Pro - Modern Styling
 * Design: Mathematical elegance with ML-inspired aesthetics
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color System - Deep Purple & Mathematical Blue */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #10b981;
    --background: #0a0e27;
    --surface: #151932;
    --surface-elevated: #1d2241;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d3655;
    --shadow: rgba(102, 126, 234, 0.2);
    
    /* Typography */
    --font-display: 'Space Mono', monospace;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 30px var(--shadow);
}

/* Global Reset & Base */
.integral-calculator-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.integral-calculator-wrapper {
    font-family: var(--font-body);
    background: var(--background);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    padding: var(--spacing-lg);
}

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

/* Header Styles */
.calc-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
    position: relative;
}

.calc-header::before {
    content: '∫';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 120px;
    opacity: 0.05;
    font-family: var(--font-display);
    pointer-events: none;
}

.calc-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    animation: fadeInUp 0.8s ease-out;
}

.calc-header .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Page Header for Individual Integrals */
.page-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.meta-info {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.badge.search-volume {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.badge.difficulty {
    background: var(--success);
    color: white;
}

/* Calculator Interface */
.calculator-interface {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
    transition: all 0.3s ease;
}

.calculator-interface:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-size: 1.125rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    background: var(--surface-elevated);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.integral-symbol,
.dx-symbol {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    user-select: none;
}

#integral-input,
.integral-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-family: var(--font-display);
    outline: none;
    padding: var(--spacing-sm);
}

#integral-input::placeholder,
.integral-input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.calculate-button,
#calculate-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.calculate-button::before,
#calculate-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.calculate-button:hover::before,
#calculate-btn:hover::before {
    width: 300px;
    height: 300px;
}

.calculate-button:hover,
#calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.calculate-button:active,
#calculate-btn:active {
    transform: translateY(0);
}

/* Quick Examples */
.quick-examples {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}

.examples-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.example-btn {
    padding: 0.5rem 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Result Section */
.result-section {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    animation: slideInUp 0.4s ease-out;
}

.result-header h3 {
    color: var(--primary);
    font-family: var(--font-display);
    margin-bottom: var(--spacing-md);
}

.final-answer {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 2px solid var(--primary);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.15);
}

.answer-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.answer-content {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-family: var(--font-display);
}

/* Steps Section */
.steps-section {
    margin: var(--spacing-xl) 0;
}

.steps-section h2 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    font-size: 2rem;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.step {
    display: flex;
    gap: var(--spacing-md);
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out backwards;
}

.step:nth-child(1) { animation-delay: 0.1s; }
.step:nth-child(2) { animation-delay: 0.2s; }
.step:nth-child(3) { animation-delay: 0.3s; }
.step:nth-child(4) { animation-delay: 0.4s; }

.step:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.step-number {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-family: var(--font-display);
}

.step-content {
    flex: 1;
}

.step-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-size: 1rem;
}

.step-math {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-family: var(--font-display);
    padding: var(--spacing-md);
    background: var(--surface-elevated);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

/* ML Context Section */
.ml-context-section {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.ml-context-section::before {
    content: '🤖';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 80px;
    opacity: 0.1;
}

.ml-context-section h2 {
    font-family: var(--font-display);
    margin-bottom: var(--spacing-md);
    font-size: 1.75rem;
}

.ml-content {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.125rem;
}

.ml-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.benefit {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.benefit:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.benefit h3 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.25rem;
}

/* Integral Grid */
.integral-grid,
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.integral-card,
.related-card {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.integral-card:hover,
.related-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.integral-function {
    font-size: 1.5rem;
    font-family: var(--font-display);
    color: var(--text-primary);
}

.integral-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb .separator {
    color: var(--text-muted);
}

/* FAQ Section */
.faq-section {
    margin: var(--spacing-xl) 0;
}

.faq-section h2 {
    font-family: var(--font-display);
    margin-bottom: var(--spacing-lg);
    font-size: 2rem;
}

.faq-item {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: var(--spacing-md);
}

.faq-item h3 {
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    font-size: 1.25rem;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

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

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

/* LaTeX Rendering */
.latex-render {
    display: inline-block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .integral-calculator-wrapper {
        padding: var(--spacing-md);
    }
    
    .calc-header h1 {
        font-size: 2.5rem;
    }
    
    .calculator-interface {
        padding: var(--spacing-lg);
    }
    
    .input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .integral-symbol,
    .dx-symbol {
        font-size: 1.5rem;
    }
    
    .integral-grid,
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .ml-benefits {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .calculator-interface,
    .quick-examples,
    .calculate-button {
        display: none;
    }
    
    .integral-calculator-wrapper {
        background: white;
        color: black;
    }
}
