/**
 * Modern Equation Solver Tool - Professional Styling
 * Following code-formatters standard with advanced mathematical equation solving features
 */

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    line-height: 1.6;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.hero-feature i {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Main Content */
.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mode-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.mode-tab.active {
    background: white;
    color: #495057;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mode-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.7);
    color: #495057;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Solver Forms */
.solver-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.solver-section h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
    font-family: 'Courier New', monospace;
}

.form-control:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-control.equation-input {
    font-size: 1.1rem;
    line-height: 1.4;
}

.equation-textarea {
    min-height: 120px;
    resize: vertical;
}

.input-help {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Equation Type Selector */
.equation-type-section {
    background: #f8f9fc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid #e9ecef;
}

.equation-type-section h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-weight: 600;
    font-size: 1rem;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.type-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
    cursor: pointer;
}

.type-option:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.type-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.type-option input[type="radio"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #667eea;
}

.type-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.type-description {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Advanced Options */
.advanced-options {
    background: #f8f9fc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid #e9ecef;
}

.advanced-options h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-weight: 600;
    font-size: 1rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    cursor: pointer;
}

.option-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.option-item input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #667eea;
}

.option-item label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

/* Results Display */
.results-container {
    background: linear-gradient(135deg, #f8f9fc 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid #dee2e6;
}

.result-main {
    text-align: center;
    margin-bottom: 2rem;
}

.solution-display {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 1rem;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.solution-summary {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 2rem;
}

.solution-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.solution-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f3f4;
}

.solution-card h4 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.solution-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.solution-label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Steps Display */
.steps-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.steps-section h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.step-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f8f9fc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.step-number {
    background: #667eea;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-equation {
    font-family: 'Courier New', monospace;
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.step-explanation {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Graph Display */
.graph-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.graph-container {
    width: 100%;
    height: 400px;
    background: #f8f9fc;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1.1rem;
}

.graph-placeholder {
    text-align: center;
}

.graph-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Examples Section */
.examples-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.example-card {
    background: linear-gradient(135deg, #f8f9fc 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.example-card h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-weight: 600;
}

.example-equation {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 1rem;
    color: #495057;
}

.example-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

.example-difficulty {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* History Section */
.history-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-box {
    flex: 1;
    min-width: 300px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-details {
    flex: 1;
}

.history-equation {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
    font-family: 'Courier New', monospace;
}

.history-solution {
    color: #6c757d;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.history-timestamp {
    color: #adb5bd;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

.no-history {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-history i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Quick Reference */
.quick-reference {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.quick-reference h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.reference-card {
    background: #f8f9fc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.reference-card h4 {
    color: #667eea;
    margin-bottom: 1rem;
    font-weight: 600;
}

.reference-list {
    list-style: none;
    padding: 0;
}

.reference-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.reference-list li:last-child {
    border-bottom: none;
}

.reference-symbol {
    font-weight: 600;
    color: #495057;
}

.reference-meaning {
    color: #6c757d;
}

/* Features Section */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-weight: 600;
}

.feature-card p {
    color: #6c757d;
    line-height: 1.6;
}

/* How to Use Section */
.how-to-use {
    background: linear-gradient(135deg, #f8f9fc 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 2rem;
    margin: 3rem 0;
}

.how-to-use h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.steps-list {
    list-style: none;
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-number {
    background: #667eea;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-text {
    color: #495057;
    line-height: 1.6;
}

/* Notifications */
.notification {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.notification.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.notification.info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.notification i {
    font-size: 1.2rem;
}

.notification-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
}

/* Export/Import Styles */
.data-management {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.data-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    padding: 0.875rem 2rem;
    background: #6c757d;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.file-input-label:hover {
    background: #545b62;
    transform: translateY(-2px);
}

/* Mathematical Expression Formatting */
.math-expression {
    font-family: 'Times New Roman', serif;
    font-size: 1.2rem;
    line-height: 1.6;
}

.math-superscript {
    vertical-align: super;
    font-size: 0.8em;
}

.math-subscript {
    vertical-align: sub;
    font-size: 0.8em;
}

.math-fraction {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
}

.math-numerator {
    display: block;
    border-bottom: 1px solid #495057;
    padding-bottom: 2px;
}

.math-denominator {
    display: block;
    padding-top: 2px;
}

/* Equation Validation */
.equation-validation {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.validation-valid {
    color: #28a745;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.validation-invalid {
    color: #dc3545;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.validation-warning {
    color: #ffc107;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-features {
        gap: 1.5rem;
        flex-direction: column;
        align-items: center;
    }
    
    .tab-navigation {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mode-tab {
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .type-selector,
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        text-align: center;
        justify-content: center;
    }
    
    .solution-display {
        font-size: 1.5rem;
    }
    
    .solution-details {
        grid-template-columns: 1fr;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .reference-grid {
        grid-template-columns: 1fr;
    }
    
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .history-actions {
        align-self: flex-end;
    }
    
    .data-actions {
        flex-direction: column;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-container {
        padding: 1.5rem 0.5rem;
    }
    
    .solver-section,
    .examples-section,
    .history-section,
    .quick-reference,
    .steps-section,
    .graph-section {
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .solution-display {
        font-size: 1.2rem;
    }
    
    .solution-value {
        font-size: 1.2rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .solver-section,
    .examples-section,
    .history-section,
    .quick-reference,
    .steps-section,
    .graph-section,
    .feature-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .form-control {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .form-control:focus {
        background: #2d3748;
        border-color: #667eea;
    }
    
    .equation-type-section,
    .advanced-options,
    .type-option,
    .option-item,
    .example-card,
    .reference-card,
    .solution-card,
    .step-item {
        background: #4a5568;
        border-color: #718096;
    }
    
    .results-container,
    .how-to-use {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .steps-list li {
        background: #4a5568;
        border-color: #718096;
    }
    
    .graph-container {
        background: #4a5568;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
.btn:focus,
.form-control:focus,
.mode-tab:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        border: 2px solid #fff;
    }
    
    .form-control {
        border-width: 3px;
    }
}
