/* Optics Simulator Styles */

/* Telescope type tabs */
.optics-tab {
    background: #374151;
    color: #9ca3af;
    border: 1px solid #4b5563;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}

.optics-tab:hover {
    background: #4b5563;
    color: #e5e7eb;
}

.optics-tab.active {
    background: #1e40af;
    color: #ffffff;
    border-color: #3b82f6;
}

/* SVG viewport container */
.optics-viewport {
    background: #0a0a1a;
    border-radius: 8px;
    border: 1px solid #1f2937;
    overflow: hidden;
    position: relative;
    min-height: 320px;
}

.optics-viewport svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Sidebar panel */
.optics-sidebar {
    min-width: 220px;
}

.optics-panel {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 12px;
}

.optics-panel h4 {
    color: #e5e7eb;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.optics-panel label {
    color: #9ca3af;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.optics-panel input[type="number"] {
    background: #111827;
    border: 1px solid #374151;
    color: #e5e7eb;
    border-radius: 4px;
    padding: 4px 6px;
    width: 80px;
    font-size: 0.8rem;
    text-align: right;
    font-family: ui-monospace, monospace;
}

.optics-panel input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
}

.optics-panel select {
    background: #111827;
    border: 1px solid #374151;
    color: #e5e7eb;
    border-radius: 4px;
    padding: 4px 6px;
    width: 100%;
    font-size: 0.8rem;
    cursor: pointer;
}

.optics-panel select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Computed values */
.optics-computed {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    font-size: 0.8rem;
}

.optics-computed .label {
    color: #6b7280;
}

.optics-computed .value {
    color: #e5e7eb;
    font-family: ui-monospace, monospace;
    text-align: right;
}

/* Focuser slider */
.optics-focuser-track {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.optics-focuser-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    background: #374151;
    border-radius: 3px;
    outline: none;
}

.optics-focuser-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #3b82f6;
    cursor: grab;
    border: 2px solid #1e3a5f;
}

.optics-focuser-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #3b82f6;
    cursor: grab;
    border: 2px solid #1e3a5f;
}

.optics-focuser-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
}

/* Focus status indicator */
.optics-focus-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    text-align: center;
    min-width: 160px;
}

.optics-focus-status.in-focus {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.optics-focus-status.near-focus {
    color: #eab308;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.optics-focus-status.out-focus {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Reducer checkbox */
.optics-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.8rem;
}

.optics-checkbox input[type="checkbox"] {
    accent-color: #3b82f6;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Radio button group for lens type */
.optics-radio-group {
    display: flex;
    gap: 12px;
}

.optics-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.8rem;
}

.optics-radio input[type="radio"] {
    accent-color: #3b82f6;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Tube seeing slider */
.optics-seeing-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    background: #374151;
    border-radius: 3px;
    outline: none;
    margin-top: 4px;
}

.optics-seeing-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f97316;
    cursor: pointer;
    border: 2px solid #7c2d12;
}

.optics-seeing-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f97316;
    cursor: pointer;
    border: 2px solid #7c2d12;
}

.optics-seeing-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* SVG element styles */
.optics-tube {
    fill: #1a1a2e;
    stroke: #4b5563;
    stroke-width: 1.5;
}

.optics-mirror {
    fill: none;
    stroke: #c0c0c0;
    stroke-width: 2;
}

.optics-mirror-fill {
    fill: url(#mirrorGradient);
    stroke: #c0c0c0;
    stroke-width: 1.5;
}

.optics-lens {
    fill: rgba(96, 165, 250, 0.15);
    stroke: #60a5fa;
    stroke-width: 1.5;
}

.optics-corrector {
    fill: rgba(96, 165, 250, 0.08);
    stroke: #60a5fa;
    stroke-width: 1;
}

.optics-ray {
    fill: none;
    stroke: #fbbf24;
    stroke-width: 1.2;
    stroke-linecap: round;
}

/* Chromatic ray colors */
.optics-ray.optics-ray-red {
    stroke: #ff6666;
    stroke-width: 1;
    opacity: 0.7;
}

.optics-ray.optics-ray-green {
    stroke: #66ff66;
    stroke-width: 1.2;
    opacity: 0.8;
}

.optics-ray.optics-ray-blue {
    stroke: #6688ff;
    stroke-width: 1;
    opacity: 0.7;
}

/* Chromatic focal point dots */
.optics-ray-red-dot {
    fill: #ff6666;
    opacity: 0.8;
}

.optics-ray-green-dot {
    fill: #66ff66;
    opacity: 0.8;
}

.optics-ray-blue-dot {
    fill: #6688ff;
    opacity: 0.8;
}

.optics-ray-animated {
    stroke-dasharray: 8 4;
    animation: rayFlow 0.8s linear infinite;
}

.optics-focal-point {
    fill: #fbbf24;
    opacity: 0.8;
}

/* Flint glass element (slightly different tint from crown) */
.optics-lens-flint {
    fill: rgba(180, 140, 250, 0.15);
    stroke: #a78bfa;
    stroke-width: 1.5;
}

.optics-focuser {
    fill: #2d2d4e;
    stroke: #6b7280;
    stroke-width: 1.5;
    cursor: grab;
}

.optics-focuser:active {
    cursor: grabbing;
}

.optics-eyepiece {
    fill: #1a1a2e;
    stroke: #9ca3af;
    stroke-width: 1;
}

.optics-baffle {
    fill: #0d0d1a;
    stroke: #374151;
    stroke-width: 1;
}

.optics-reducer {
    fill: rgba(168, 85, 247, 0.15);
    stroke: #a855f7;
    stroke-width: 1;
}

.optics-diagonal {
    fill: #c0c0c0;
    stroke: #e5e7eb;
    stroke-width: 1;
}

.optics-spider {
    stroke: #6b7280;
    stroke-width: 0.8;
}

.optics-cfz-zone {
    fill: rgba(34, 197, 94, 0.08);
    stroke: rgba(34, 197, 94, 0.3);
    stroke-width: 1;
    stroke-dasharray: 4 2;
}

.optics-confusion {
    fill: none;
    stroke: #ef4444;
    stroke-width: 1;
    opacity: 0.6;
}

/* Eyepiece view inset */
.epview-bg {
    fill: #050510;
    stroke: none;
}

.epview-border {
    fill: none;
    stroke: #4b5563;
    stroke-width: 2;
}

/* Ray flow animation */
@keyframes rayFlow {
    to {
        stroke-dashoffset: -12;
    }
}

/* Night mode overrides */
[data-theme="night"] .optics-tab {
    background: #2a0000;
    color: #884444;
    border-color: #440000;
}

[data-theme="night"] .optics-tab:hover {
    background: #3a0000;
    color: #cc6666;
}

[data-theme="night"] .optics-tab.active {
    background: #3a0000;
    color: #ff6666;
    border-color: #660000;
}

[data-theme="night"] .optics-viewport {
    background: #0a0000;
    border-color: #330000;
}

[data-theme="night"] .optics-panel {
    background: #1a0000;
    border-color: #440000;
}

[data-theme="night"] .optics-panel h4 {
    color: #cc6666;
}

[data-theme="night"] .optics-panel label {
    color: #884444;
}

[data-theme="night"] .optics-panel input[type="number"] {
    background: #0d0000;
    border-color: #440000;
    color: #cc6666;
}

[data-theme="night"] .optics-panel select {
    background: #0d0000;
    border-color: #440000;
    color: #cc6666;
}

[data-theme="night"] .optics-focuser-track {
    background: #0d0000;
    border-color: #440000;
}

[data-theme="night"] .optics-focuser-slider {
    background: #440000;
}

[data-theme="night"] .optics-focuser-slider::-webkit-slider-thumb {
    background: #cc3333;
    border-color: #660000;
}

[data-theme="night"] .optics-focuser-slider::-moz-range-thumb {
    background: #cc3333;
    border-color: #660000;
}

[data-theme="night"] .optics-seeing-slider {
    background: #440000;
}

[data-theme="night"] .optics-seeing-slider::-webkit-slider-thumb {
    background: #cc4444;
    border-color: #660000;
}

[data-theme="night"] .optics-seeing-slider::-moz-range-thumb {
    background: #cc4444;
    border-color: #660000;
}

[data-theme="night"] .optics-ray {
    stroke: #cc3333;
}

[data-theme="night"] .optics-ray.optics-ray-red {
    stroke: #cc4444;
    opacity: 0.6;
}

[data-theme="night"] .optics-ray.optics-ray-green {
    stroke: #aa5555;
    opacity: 0.7;
}

[data-theme="night"] .optics-ray.optics-ray-blue {
    stroke: #884466;
    opacity: 0.6;
}

[data-theme="night"] .optics-ray-red-dot { fill: #cc4444; }
[data-theme="night"] .optics-ray-green-dot { fill: #aa5555; }
[data-theme="night"] .optics-ray-blue-dot { fill: #884466; }

[data-theme="night"] .optics-lens-flint {
    fill: rgba(204, 68, 68, 0.08);
    stroke: #884466;
}

[data-theme="night"] .optics-radio {
    color: #884444;
}

[data-theme="night"] .epview-bg {
    fill: #050000;
}

[data-theme="night"] .epview-border {
    stroke: #440000;
}

[data-theme="night"] .optics-focal-point {
    fill: #cc3333;
}

[data-theme="night"] .optics-lens {
    fill: rgba(204, 68, 68, 0.1);
    stroke: #884444;
}

[data-theme="night"] .optics-corrector {
    fill: rgba(204, 68, 68, 0.05);
    stroke: #884444;
}

[data-theme="night"] .optics-mirror {
    stroke: #884444;
}

[data-theme="night"] .optics-mirror-fill {
    stroke: #884444;
}

[data-theme="night"] .optics-tube {
    fill: #1a0000;
    stroke: #440000;
}

[data-theme="night"] .optics-focuser {
    fill: #2a0000;
    stroke: #664444;
}

[data-theme="night"] .optics-eyepiece {
    fill: #1a0000;
    stroke: #664444;
}

[data-theme="night"] .optics-diagonal {
    fill: #884444;
    stroke: #aa6666;
}

[data-theme="night"] .optics-spider {
    stroke: #664444;
}

[data-theme="night"] .optics-reducer {
    fill: rgba(204, 68, 68, 0.1);
    stroke: #884444;
}

[data-theme="night"] .optics-focus-status.in-focus {
    color: #cc4444;
    background: rgba(204, 68, 68, 0.1);
    border-color: rgba(204, 68, 68, 0.3);
}

[data-theme="night"] .optics-focus-status.near-focus {
    color: #cc6644;
    background: rgba(204, 102, 68, 0.1);
    border-color: rgba(204, 102, 68, 0.3);
}

[data-theme="night"] .optics-computed .label {
    color: #664444;
}

[data-theme="night"] .optics-computed .value {
    color: #cc6666;
}

/* Prevent horizontal page scrolling on mobile */
.max-w-7xl:has(.optics-main-grid) {
    overflow-x: hidden;
}

/* Chromatic Aberration Info Panel */
.optics-ca-info {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #9ca3af;
}

.optics-ca-info-inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.optics-ca-icon {
    color: #a78bfa;
    margin-top: 2px;
    flex-shrink: 0;
}

.optics-ca-info strong {
    color: #e5e7eb;
}

.optics-ca-info .ca-value {
    color: #fbbf24;
    font-family: ui-monospace, monospace;
    font-weight: 600;
}

.optics-ca-info .ca-apo {
    color: #22c55e;
}

/* Chromatic aberration SVG labels */
.optics-ca-label {
    font-family: ui-monospace, monospace;
    font-size: 7.5px;
    text-anchor: middle;
    pointer-events: none;
}

.optics-ca-bracket {
    fill: none;
    stroke: #6b7280;
    stroke-width: 0.8;
    stroke-dasharray: 3 2;
}

.optics-ca-bracket-label {
    font-family: ui-monospace, monospace;
    font-size: 7px;
    fill: #6b7280;
    text-anchor: middle;
    pointer-events: none;
}

/* Incoming white light ray (pre-lens) */
.optics-ray-white {
    fill: none;
    stroke: #ffeebb;
    stroke-width: 1.3;
    opacity: 0.7;
}

/* Night mode overrides for CA panel */
[data-theme="night"] .optics-ca-info {
    background: #0d0000;
    border-color: #440000;
    color: #884444;
}

[data-theme="night"] .optics-ca-info strong {
    color: #cc6666;
}

[data-theme="night"] .optics-ca-info .ca-value {
    color: #cc6644;
}

[data-theme="night"] .optics-ca-info .ca-apo {
    color: #cc4444;
}

[data-theme="night"] .optics-ca-icon {
    color: #884466;
}

[data-theme="night"] .optics-ca-label {
    fill: #884444 !important;
}

[data-theme="night"] .optics-ca-bracket {
    stroke: #664444;
}

[data-theme="night"] .optics-ca-bracket-label {
    fill: #664444;
}

[data-theme="night"] .optics-ray-white {
    stroke: #cc8866;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .optics-main-grid {
        grid-template-columns: 1fr !important;
    }

    .optics-sidebar {
        min-width: unset;
        order: -1;
    }

    .optics-viewport {
        min-height: 250px;
        touch-action: pan-y;
    }

    .optics-focuser-slider {
        touch-action: none;
    }

    .optics-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}
