/* Triangle Calculator Styles */
/* Created: 2025-11-12 */
/* Design System: Purple gradient (#667eea → #764ba2), Glass-card structure */

/* Action Buttons Grid */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Action Buttons */
.btn-custom,
.btn-custom-outline {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.btn-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-custom-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-custom-outline:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.btn-custom:active,
.btn-custom-outline:active {
    transform: translateY(0);
}

/* Sponsor Button */
.btn-sponsor {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
}

.btn-sponsor:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-sponsor:active {
    transform: translateY(0);
}

/* Mode Selection */
.mode-select-wrapper {
    margin-bottom: 1.5rem;
}

.mode-select-wrapper label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

#modeSelect {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

#modeSelect:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Input Groups */
.input-group-triangle {
    margin-bottom: 1rem;
}

.input-group-triangle label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.input-group-triangle .form-input {
    width: 100%;
}

/* Dynamic Input Visibility */
.input-hidden {
    display: none;
}

/* Result Display */
.result-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: #555;
}

.result-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #667eea;
}

.result-value.large {
    font-size: 1.5rem;
}

/* Triangle Type Badge */
.triangle-type-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.triangle-type-badge.acute {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.triangle-type-badge.right {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.triangle-type-badge.obtuse {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.triangle-type-badge.equilateral {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
}

.triangle-type-badge.isosceles {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.triangle-type-badge.scalene {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
}

/* Special Lines Section */
.special-lines-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.special-line-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.special-line-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.special-line-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

/* Canvas Visualization */
#triangleCanvas {
    width: 100%;
    max-width: 500px;
    height: 400px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    display: block;
    margin: 0 auto;
}

/* Steps Section */
.steps-container {
    margin-top: 1rem;
}

.toggle-steps-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.toggle-steps-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.toggle-steps-btn i {
    transition: transform 0.3s ease;
}

.toggle-steps-btn.expanded i {
    transform: rotate(180deg);
}

.steps-content {
    display: none;
    animation: slideDown 0.3s ease-out;
}

.steps-content.visible {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculation-step {
    background: white;
    border-left: 4px solid #667eea;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.step-description {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.step-formula {
    background: #f8f9ff;
    padding: 1rem;
    border-radius: 8px;
    margin: 0.75rem 0;
    overflow-x: auto;
}

.step-formula .katex-display {
    margin: 0;
}

.step-calculation {
    color: #555;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.step-result {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: #667eea;
    margin-top: 0.75rem;
}

/* Error Messages */
.error-message {
    background: linear-gradient(135deg, #fed7d7 0%, #feb2b2 100%);
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error-message i {
    font-size: 1.5rem;
}

.error-message.hidden {
    display: none;
}

/* Input Validation Styles */
.form-input.invalid {
    border-color: #fc8181;
    background: #fff5f5;
}

.form-input.invalid:focus {
    box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.1);
}

/* Tooltips */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    cursor: help;
}

/* Related Calculators */
.related-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-links li {
    margin-bottom: 0.75rem;
}

.related-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.5rem;
    border-radius: 6px;
}

.related-links a:hover {
    background: #f0f4ff;
    transform: translateX(5px);
}

/* Loading State */
.calculating-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.1);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.calculating-overlay.visible {
    display: flex;
}

.calculating-spinner {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .special-lines-grid {
        grid-template-columns: 1fr;
    }

    #triangleCanvas {
        height: 300px;
    }

    .result-value {
        font-size: 1.1rem;
    }

    .result-value.large {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .action-buttons-grid {
        grid-template-columns: 1fr;
    }

    .calculation-step {
        padding: 1rem;
    }

    .step-formula {
        font-size: 0.9rem;
    }

    #triangleCanvas {
        height: 250px;
    }
}

/* Print Styles */
@media print {
    .action-buttons-grid,
    .toggle-steps-btn {
        display: none;
    }

    .steps-content {
        display: block !important;
    }

    .glass-card {
        page-break-inside: avoid;
    }
}
