/**
 * Circle & Sector Calculator Styles
 * 圓與扇形計算器樣式
 */

/* ===== Main Container ===== */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}


/* ===== Form Inputs ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:hover {
    border-color: #667eea;
}

/* Input with unit suffix */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-unit input {
    flex: 1;
}

.input-with-unit .unit {
    font-weight: 600;
    color: #667eea;
    font-size: 0.95rem;
}

/* Angle Input Group (dual input for degree/radian) */
.angle-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.angle-input-group input,
.angle-input-group select {
    flex: 1;
}

/* Preset Angle Selector */
#presetAngleGroup,
#customAngleGroup {
    margin-top: 1rem;
}

#customAngleGroup {
    display: none;
}

/* ===== Results Display ===== */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-label i {
    color: #667eea;
    font-size: 1rem;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.result-value .number {
    color: #667eea;
}

.result-value .unit {
    font-size: 1.2rem;
    color: #666;
    font-weight: 500;
}

/* ===== Calculation Steps ===== */
.steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-steps {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-steps:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.toggle-steps.active {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.steps-content {
    display: none;
    margin-top: 1rem;
}

.calculation-step {
    background: rgba(102, 126, 234, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.step-number {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.step-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

.step-formula {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    margin: 1rem 0;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* KaTeX formula styling */
.step-formula .katex {
    font-size: 1.1rem;
}

.step-formula .katex-display {
    margin: 0.5rem 0;
}

.step-explanation {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 6px;
    border-left: 3px solid #48bb78;
}

/* ===== SVG Visualization ===== */
.circle-visualization {
    width: 100%;
    height: 300px;
    background: rgba(102, 126, 234, 0.03);
    border-radius: 8px;
    border: 2px solid rgba(102, 126, 234, 0.1);
}

#circleVisualization {
    width: 100%;
    height: 100%;
}

/* SVG element styling */
svg text {
    user-select: none;
    -webkit-user-select: none;
}

svg path,
svg circle,
svg line {
    transition: all 0.3s ease;
}

/* ===== Action Buttons Grid ===== */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ===== Tooltips ===== */
.info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.info-icon:hover {
    background: #764ba2;
}

/* ===== Keyboard Shortcuts Hint ===== */
.keyboard-shortcuts {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #666;
}

.keyboard-shortcuts h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.keyboard-shortcuts kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== Loading State ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Responsive Design ===== */

/* Tablet (≤992px) */
@media (max-width: 992px) {
    .page-header h1 {
        font-size: 2rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .seo-section {
        padding: 1.5rem;
    }
}

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem 0.5rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .glass-card {
        padding: 1.25rem;
    }

    .circle-visualization {
        height: 250px;
    }

    .angle-input-group {
        flex-direction: column;
    }

    .result-value {
        font-size: 1.4rem;
    }

    .step-formula .katex {
        font-size: 0.95rem;
    }
}

/* Mobile (≤576px) */
@media (max-width: 576px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header .subtitle {
        font-size: 0.95rem;
    }

    .glass-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .glass-card h3 {
        font-size: 1.1rem;
    }

    .action-buttons-grid {
        grid-template-columns: 1fr;
    }

    .btn-custom,
    .btn-custom-outline,
    .btn-sponsor {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }

    .result-value {
        font-size: 1.3rem;
    }

    .result-value .unit {
        font-size: 1rem;
    }

    .circle-visualization {
        height: 200px;
    }

    .calculation-step {
        padding: 1rem;
    }

    .step-formula {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .step-formula .katex {
        font-size: 0.85rem;
    }

    .seo-section {
        padding: 1rem;
        margin-top: 2rem;
    }

    .seo-section h2 {
        font-size: 1.5rem;
    }

    .seo-section h3 {
        font-size: 1.2rem;
    }

    .seo-section ol,
    .seo-section ul {
        margin-left: 1.5rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    .action-buttons-grid,
    .toggle-steps,
    .keyboard-shortcuts {
        display: none;
    }

    .glass-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .steps-content {
        display: block !important;
    }

    .seo-section {
        page-break-before: always;
    }
}

/* ===== Accessibility ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-card {
        border: 2px solid #333;
    }

    .btn-custom,
    .btn-sponsor {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* Uncomment when implementing dark mode */
    /*
    .glass-card {
        background: rgba(50, 50, 50, 0.95);
        color: #e0e0e0;
    }

    .form-input {
        background: #333;
        color: #e0e0e0;
        border-color: #555;
    }
    */
}
