/**
 * Fourier Series Approximation Visualization Styles
 */

.fourier-approximation-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Header Styles */
.fourier-approximation-container header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.fourier-approximation-container header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    font-weight: 600;
}

.fourier-approximation-container .subtitle {
    margin: 0;
    font-size: 1.15em;
    opacity: 0.95;
}

.formula-display {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.formula-main {
    font-family: 'Times New Roman', serif;
    font-size: 1.3em;
    font-style: italic;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.fourier-approximation-container main {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

/* Visualization Section */
.visualization-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .visualization-section {
        grid-template-columns: 1fr;
    }
}

.canvas-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.canvas-wrapper {
    position: relative;
}

#mainCanvas {
    width: 100%;
    height: 400px;
    display: block;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.canvas-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Spectrum Container */
.spectrum-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

#spectrumCanvas {
    width: 100%;
    height: 400px;
    display: block;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.spectrum-label {
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
    color: #555;
}

/* Controls Section */
.controls-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.harmonics-display {
    margin-top: 8px;
    padding: 8px;
    background: #f0f4ff;
    border-radius: 5px;
    font-size: 0.85em;
    color: #555;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.4);
}

/* Coefficients Section */
.coefficients-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.coefficients-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.coefficients-table {
    overflow-x: auto;
    margin-top: 15px;
}

.coefficients-table table {
    width: 100%;
    border-collapse: collapse;
}

.coefficients-table th,
.coefficients-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.coefficients-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.coefficients-table tr:hover {
    background: #f8f9fa;
}

.coefficient-value {
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-weight: 600;
}

.contribution-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.contribution-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s;
}

/* Info Section */
.info-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
}

/* Explanation Section */
.explanation {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.explanation h2 {
    color: #333;
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.explanation h3 {
    color: #555;
    font-size: 1.4em;
    margin-top: 25px;
    margin-bottom: 15px;
}

.explanation p {
    line-height: 1.8;
    color: #666;
    margin-bottom: 15px;
}

.explanation ul {
    list-style: none;
    padding-left: 0;
}

.explanation li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
    color: #666;
    line-height: 1.6;
}

.explanation li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.explanation ol {
    padding-left: 25px;
}

.explanation ol li {
    padding-left: 5px;
}

.explanation ol li:before {
    content: none;
}

/* Concept Grid */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.concept-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: transform 0.3s, box-shadow 0.3s;
}

.concept-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.concept-card h4 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.concept-card p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

/* Formulas Grid */
.formulas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.formula-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s;
}

.formula-card:hover {
    border-color: #667eea;
}

.formula-card h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.1em;
}

.formula {
    font-family: 'Times New Roman', serif;
    font-size: 1.1em;
    font-style: italic;
    color: #667eea;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

.formula-card p {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 0.95em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fourier-approximation-container {
        padding: 10px;
    }

    .fourier-approximation-container header h1 {
        font-size: 1.8em;
    }

    .fourier-approximation-container .subtitle {
        font-size: 1em;
    }

    #mainCanvas,
    #spectrumCanvas {
        height: 300px;
    }

    .controls-section {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
