/* Moon Map Page Styles */

.moon-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 64px); /* subtract navbar height */
    overflow-x: hidden;
}

/* Header */
.moon-header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: #111827;
    border-bottom: 1px solid #1f2937;
    flex-shrink: 0;
    gap: 12px;
}

.moon-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.moon-header-left h3 {
    color: #e5e7eb;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.back-button {
    color: #9ca3af;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}

.back-button:hover {
    color: #e5e7eb;
    background: #1f2937;
}

/* Time control */
.moon-header-center {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.moon-time-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.moon-time-input {
    background: #1f2937;
    color: #e5e7eb;
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: inherit;
    height: 30px;
    box-sizing: border-box;
}

.moon-time-input[type="date"] {
    width: 130px;
}

.moon-time-input[type="time"] {
    width: 90px;
}

.moon-time-input:focus {
    outline: none;
    border-color: #4b5563;
}

.time-step-btn {
    background: #1f2937;
    color: #9ca3af;
    border: 1px solid #374151;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    height: 30px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.time-step-btn:hover {
    background: #374151;
    color: #e5e7eb;
}

.moon-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: flex-end;
    overflow: hidden;
}

.moon-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.phase-name {
    color: #fbbf24;
    font-weight: 600;
    font-size: 0.95rem;
}

.illumination {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* Optics orientation buttons */
.optics-controls {
    display: flex;
    gap: 2px;
    background: #1a1f2e;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 2px;
}

.optics-btn {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.optics-btn:hover {
    color: #d1d5db;
    background: rgba(255, 255, 255, 0.05);
}

.optics-btn.active {
    background: #1e3a5f;
    color: #60a5fa;
}

.optics-label {
    color: #9ca3af;
    font-size: 0.7rem;
    padding: 0 6px;
    white-space: nowrap;
    align-self: center;
}

.moon-controls {
    display: flex;
    gap: 4px;
}

.moon-btn {
    background: #1f2937;
    color: #9ca3af;
    border: 1px solid #374151;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.moon-btn:hover {
    background: #374151;
    color: #e5e7eb;
}

.moon-btn.active {
    background: #1e3a5f;
    color: #60a5fa;
    border-color: #2563eb;
}

/* Main content */
.moon-content {
    display: flex;
    flex: 0 0 auto;
    height: calc(100vh - 170px);
    overflow: hidden;
}

/* Canvas container */
.moon-canvas-container {
    flex: 1;
    position: relative;
    background: #0a0a14;
    overflow: hidden;
}

#moon3d-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#moon3d-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.moon-zoom-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 3;
}

.zoom-btn {
    background: rgba(17, 24, 39, 0.85);
    color: #d1d5db;
    border: 1px solid #374151;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.zoom-btn:hover {
    background: rgba(31, 41, 55, 0.95);
    color: #ffffff;
}

/* Center crosshair */
.moon-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 4;
}

.moon-crosshair-h,
.moon-crosshair-v {
    position: absolute;
    background: rgba(255, 255, 255, 0.35);
}

.moon-crosshair-h {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-0.5px);
}

.moon-crosshair-v {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-0.5px);
}

.moon-crosshair-label {
    display: none;
}

@media (max-width: 768px) {
    .moon-crosshair-label:not(:empty) {
        display: block;
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 6px;
        white-space: nowrap;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.85);
        text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 0.9);
    }
}

/* Tooltip */
.moon-tooltip {
    position: absolute;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 10px 12px;
    max-width: 220px;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tooltip-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.tooltip-type {
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: capitalize;
    margin-bottom: 4px;
}

.tooltip-desc {
    color: #d1d5db;
    font-size: 0.78rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.tooltip-coords {
    color: #6b7280;
    font-size: 0.7rem;
    font-family: monospace;
}

/* Highlights panel */
.moon-highlights-panel {
    width: 280px;
    background: #111827;
    border-left: 1px solid #1f2937;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 12px;
}

.highlights-title {
    color: #e5e7eb;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.highlights-subtitle {
    color: #6b7280;
    font-size: 0.75rem;
    margin: 0 0 12px 0;
}

.highlights-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.highlight-item {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.highlight-item:hover {
    background: #283548;
    border-color: #4b5563;
}

.highlight-header {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
}

.highlight-name {
    color: #e5e7eb;
    font-weight: 500;
    font-size: 0.85rem;
    flex: 1;
}

.interest-badge {
    color: #fbbf24;
    font-size: 0.75rem;
    margin-right: 6px;
}

.highlight-proximity {
    color: #6b7280;
    font-size: 0.7rem;
    font-family: monospace;
}

.highlight-desc {
    color: #9ca3af;
    font-size: 0.72rem;
    line-height: 1.3;
}

.no-highlights {
    color: #6b7280;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
}

.loading-placeholder {
    color: #6b7280;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
}

/* Footer info bar */
.moon-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 16px;
    background: #111827;
    border-top: 1px solid #1f2937;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #9ca3af;
}

.footer-sep {
    color: #374151;
}

/* Dashboard */
.moon-dashboard {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.moon-dashboard .dash-card {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.moon-dashboard .dash-card-title {
    color: #e5e7eb;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.moon-dashboard .info-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.moon-dashboard .info-pill {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.moon-dashboard .info-pill .pill-label {
    color: #9ca3af;
}

.moon-dashboard .info-pill .pill-value {
    color: #ffffff;
    font-weight: 600;
    margin-left: 0.25rem;
    font-family: ui-monospace, monospace;
}

.moon-dashboard .dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.moon-dashboard .dash-tile {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.moon-dashboard .dash-tile-label {
    color: #9ca3af;
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.moon-dashboard .dash-tile-value {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: ui-monospace, monospace;
}

.moon-dashboard .dash-tile-sub {
    color: #6b7280;
    font-size: 0.7rem;
    margin-top: 0.125rem;
}

.moon-dashboard .dash-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.85rem;
}

.moon-dashboard .dash-row + .dash-row {
    border-top: 1px solid #374151;
}

.moon-dashboard .dash-row-label {
    color: #9ca3af;
}

.moon-dashboard .dash-row-value {
    color: #ffffff;
    font-family: ui-monospace, monospace;
    font-weight: 500;
}

.moon-dashboard .phases-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    text-align: center;
}

.moon-dashboard .phase-item {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.75rem 0.5rem;
}

.moon-dashboard .phase-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.moon-dashboard .phase-name {
    color: #d1d5db;
    font-size: 0.7rem;
    font-weight: 500;
}

.moon-dashboard .phase-date {
    color: #9ca3af;
    font-size: 0.65rem;
    margin-top: 0.125rem;
    font-family: ui-monospace, monospace;
}

.moon-dashboard .libration-visual {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid #4b5563;
    background: #111827;
    position: relative;
    margin: 0 auto;
}

.moon-dashboard .libration-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    position: absolute;
    transform: translate(-50%, -50%);
    transition: all 0.3s;
}

.moon-dashboard .libration-crosshair {
    position: absolute;
    background: #374151;
}

.moon-dashboard .libration-crosshair-h {
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
}

.moon-dashboard .libration-crosshair-v {
    left: 50%;
    top: 10%;
    bottom: 10%;
    width: 1px;
}

.moon-dashboard .progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #374151;
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.moon-dashboard .progress-bar-fill {
    height: 100%;
    background: #fbbf24;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Night mode support */
[data-theme="night"] .moon-header,
[data-theme="night"] .moon-highlights-panel,
[data-theme="night"] .moon-footer {
    background: #1a0000;
    border-color: #330000;
}

[data-theme="night"] .optics-controls {
    background: #1a0000;
    border-color: #440000;
}

[data-theme="night"] .optics-btn.active {
    background: #3a0000;
    color: #ff6666;
}

[data-theme="night"] .optics-label {
    color: #993333;
}

[data-theme="night"] .moon-btn,
[data-theme="night"] .time-step-btn {
    background: #2a0000;
    border-color: #440000;
    color: #cc4444;
}

[data-theme="night"] .moon-time-input {
    background: #2a0000;
    border-color: #440000;
    color: #cc8888;
}

[data-theme="night"] .moon-btn.active {
    background: #3a0000;
    color: #ff6666;
    border-color: #660000;
}

[data-theme="night"] .highlight-item {
    background: #2a0000;
    border-color: #440000;
}

[data-theme="night"] .phase-name {
    color: #cc6600;
}

[data-theme="night"] .highlights-title {
    color: #cc8888;
}

[data-theme="night"] .highlight-name {
    color: #cc8888;
}

[data-theme="night"] .moon-crosshair-h,
[data-theme="night"] .moon-crosshair-v {
    background: rgba(204, 68, 68, 0.4);
}

[data-theme="night"] .moon-tooltip {
    background: rgba(26, 0, 0, 0.95);
    border-color: #440000;
}

[data-theme="night"] .moon-dashboard .dash-card {
    background: #1a0000;
    border-color: #330000;
}

[data-theme="night"] .moon-dashboard .info-pill,
[data-theme="night"] .moon-dashboard .dash-tile,
[data-theme="night"] .moon-dashboard .phase-item {
    background: #0d0000;
    border-color: #440000;
}

[data-theme="night"] .moon-dashboard .dash-tile-value,
[data-theme="night"] .moon-dashboard .dash-row-value,
[data-theme="night"] .moon-dashboard .pill-value {
    color: #cc8888;
}

[data-theme="night"] .moon-dashboard .progress-bar-fill {
    background: #cc4444;
}

[data-theme="night"] .moon-dashboard .libration-dot {
    background: #cc4444;
}

/* Responsive */
@media (max-width: 1200px) {
    .moon-info {
        display: none;
    }
}

@media (max-width: 1050px) {
    .optics-label {
        display: none;
    }
}

@media (max-width: 950px) {
    .moon-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .moon-header-center {
        order: 3;
        width: 100%;
        flex-shrink: 1;
    }

    .moon-time-control {
        justify-content: center;
    }

    .moon-header-right {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-end;
    }

    .moon-info {
        display: flex;
    }
}

@media (max-width: 768px) {
    .moon-content {
        flex-direction: column;
        height: calc(100vh - 220px);
    }

    .moon-highlights-panel {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid #1f2937;
    }

    .moon-time-control {
        flex-wrap: wrap;
    }

    .moon-time-input[type="date"] {
        width: 110px;
    }

    .moon-time-input[type="time"] {
        width: 76px;
    }

    .moon-footer {
        flex-wrap: wrap;
        font-size: 0.7rem;
    }

    .moon-dashboard .dash-grid-3 {
        grid-template-columns: 1fr !important;
    }

    #footer-crosshair:not(:empty) {
        width: 100%;
        text-align: center;
        font-size: 0.8rem;
    }

    #footer-crosshair-sep {
        display: none !important;
    }

    .moon-dashboard .dash-grid {
        grid-template-columns: 1fr;
    }

    .moon-dashboard .phases-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
