/* ============================================
   Limit Calculator Styles
   ============================================ */

/* Action Buttons Grid */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Input Section */
.limit-input-group {
    margin-bottom: 1.25rem;
}

.limit-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.95rem;
}

.limit-input-group .form-input {
    width: 100%;
}

/* Results Display */
.limit-result-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    color: white;
    text-align: center;
    margin-bottom: 1.5rem;
}

.limit-result-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.limit-result-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.limit-result-notation {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-top: 1rem;
}

/* Limit Type Results (One-Sided) */
.limit-sided-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.limit-sided-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.limit-sided-item h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.limit-sided-item .value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Indeterminate Form Badge */
.indeterminate-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(10px);
}

/* Approach Table */
.approach-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.approach-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.approach-table thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.approach-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.approach-table tbody tr:last-child td {
    border-bottom: none;
}

.approach-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.approach-table .x-value {
    font-weight: 600;
    color: #667eea;
}

.approach-table .fx-value {
    font-family: 'Courier New', monospace;
    color: #374151;
}

/* Approach Direction Headers */
.approach-direction-header {
    background: #f3f4f6 !important;
    color: #374151 !important;
    font-weight: 600;
    text-align: center;
}

.approach-from-left {
    color: #48bb78 !important;
}

.approach-from-right {
    color: #f59e0b !important;
}

/* Graph Container */
.limit-graph-container {
    position: relative;
    width: 100%;
    height: 400px;
    margin-top: 1rem;
}

#limitChart {
    max-height: 400px;
}

/* Calculation Steps */
.calculation-steps {
    margin-top: 1.5rem;
}

.step-toggle-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #374151;
}

.step-toggle-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.step-toggle-btn i {
    transition: transform 0.3s ease;
}

.step-toggle-btn.active i {
    transform: rotate(180deg);
}

.steps-content {
    display: none;
    margin-top: 1rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
}

.steps-content.show {
    display: block;
}

.calculation-step {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.calculation-step:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.step-number {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    font-weight: 600;
    margin-right: 0.75rem;
}

.step-description {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.step-formula {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    overflow-x: auto;
}

.step-result {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* KaTeX Formula Styling */
.katex-display {
    margin: 1rem 0;
}

.katex {
    font-size: 1.1em;
}

/* Examples Section */
.examples-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.example-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-card:hover {
    background: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.example-card .example-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.example-card .example-formula {
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-size: 0.95rem;
}

/* Error Messages */
.error-message {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    color: #dc2626;
    margin-top: 1rem;
    display: none;
}

.error-message.show {
    display: block;
}

.error-message i {
    margin-right: 0.5rem;
}

/* Tooltips */
.tooltip-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #9ca3af;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 0.7rem;
    margin-left: 0.25rem;
    cursor: help;
}

[data-bs-toggle="tooltip"] {
    cursor: help;
}


/* Responsive Design */
@media (max-width: 991px) {
    .limit-result-value {
        font-size: 2rem;
    }

    .limit-graph-container {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .examples-grid {
        grid-template-columns: 1fr;
    }

    .limit-sided-results {
        grid-template-columns: 1fr;
    }

    .limit-graph-container {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .action-buttons-grid {
        grid-template-columns: 1fr;
    }

    .limit-result-value {
        font-size: 1.75rem;
    }

    .approach-table {
        font-size: 0.85rem;
    }

    .approach-table thead th,
    .approach-table tbody td {
        padding: 0.625rem 0.75rem;
    }
}
