@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-purple: #9b5cff;
    --primary-pink: #ff4fd8;
    --accent-aqua: #52f7d4;
    --dark-bg: rgba(16, 12, 28, 0.42);
    --panel-bg: rgba(28, 20, 44, 0.34);
    --panel-border: rgba(155, 92, 255, 0.42);
    --text-primary: #f7f2ff;
    --text-secondary: #d9d0f3;
    --text-dark: #181818;
    --glow-purple: 0 0 18px rgba(155, 92, 255, 0.38);
    --glow-pink: 0 0 18px rgba(255, 79, 216, 0.3);
    --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.24);
}

body {
    font-family: 'Rajdhani', sans-serif;
    background-image: url('galaxynightlandscape.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Earth/space background stays visible */
.mission-overlay {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            rgba(10, 10, 12, 0.30) 0%,
            rgba(14, 14, 16, 0.42) 45%,
            rgba(18, 18, 20, 0.55) 100%
        ),
        radial-gradient(
            circle at 50% 20%,
            rgba(155, 92, 255, 0.10) 0%,
            rgba(255, 79, 216, 0.05) 25%,
            transparent 60%
        );
    pointer-events: none;
    z-index: 1;
}

/* Soft tech grid */
.grid-overlay {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(155, 92, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(155, 92, 255, 0.035) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.22;
}

.control-panel {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.mission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--dark-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px 14px 0 0;
    box-shadow: var(--glow-purple), 0 8px 30px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin-bottom: 2px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary-purple);
    text-shadow: var(--glow-purple);
    letter-spacing: 2px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #5cff72;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #5cff72;
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(92, 255, 114, 0.45);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-right {
    text-align: right;
}

.mission-info {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-aqua);
    letter-spacing: 1px;
}

.location {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Main content */
.control-main {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0 0 14px 14px;
    padding: 30px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: var(--shadow-soft);
}

/* Shared panel styles */
.date-control-panel,
.image-panel,
.data-panel,
.loading-container,
.mission-footer {
    background: rgba(22, 22, 26, 0.34);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 0 12px rgba(155, 92, 255, 0.22),
        0 0 24px rgba(155, 92, 255, 0.10),
        0 6px 20px rgba(0, 0, 0, 0.22);
}

/* Panel headers */
.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

.panel-icon {
    font-size: 24px;
}

.panel-header h1,
.panel-header h2,
.panel-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--primary-purple);
    letter-spacing: 2px;
    text-shadow: var(--glow-purple);
}

.panel-header h1 { font-size: 28px; }
.panel-header h2 { font-size: 20px; }
.panel-header h3 { font-size: 18px; }

/* Mission brief */
.mission-brief {
    margin-bottom: 30px;
}

.mission-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Date control panel */
.date-control-panel {
    margin-bottom: 30px;
    padding: 25px;
}

.control-interface {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-end;
    justify-content: space-between;
}

.input-group {
    flex: 1 1 620px;
    min-width: 320px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--accent-aqua);
    margin-bottom: 12px;
    letter-spacing: 1px;
    font-family: 'Orbitron', sans-serif;
}

.date-spinners {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: nowrap;
}

.spinner-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 96px;
}

.spinner-unit--wide {
    min-width: 128px;
}

.spinner-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-aqua);
    letter-spacing: 1px;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
}

.spin-btn {
    width: 96px;
    height: 36px;
    background: linear-gradient(180deg, #3b3b40 0%, #232327 100%);
    border: 1px solid rgba(155, 92, 255, 0.35);
    border-radius: 8px;
    color: #f7efe7;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Rajdhani', sans-serif;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.spinner-unit--wide .spin-btn {
    width: 128px;
}

.spin-btn:hover:not(:disabled) {
    border-color: rgba(155, 92, 255, 0.75);
    box-shadow: 0 0 14px rgba(155, 92, 255, 0.28);
    transform: translateY(-1px);
}

.spin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.spin-display {
    width: 120px;
    height: 90px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.04) 100%),
        rgba(35, 35, 39, 0.88);
    border: 1px solid rgba(155, 92, 255, 0.38);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff4eb;
    text-align: center;
    box-shadow: inset 0 0 12px rgba(155, 92, 255, 0.08);
}

.spinner-unit--wide .spin-display {
    width: 160px;
}

.spinner-sep {
    font-size: 42px;
    line-height: 1;
    font-weight: 700;
    color: #b57cff;
    align-self: center;
    margin-bottom: 54px;
    text-shadow: 0 0 14px rgba(155, 92, 255, 0.35);
}

/* Buttons */
.quick-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}

.quick-btn {
    padding: 12px 20px;
    background: rgba(20, 20, 22, 0.60);
    border: 1px solid rgba(155, 92, 255, 0.55);
    border-radius: 8px;
    color: #f7f2ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.quick-btn:hover {
    background: rgba(155, 92, 255, 0.22);
    border-color: #c08cff;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(155, 92, 255, 0.28);
    transform: translateY(-2px);
}

.launch-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-purple));
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 18px rgba(155, 92, 255, 0.35);
}

.launch-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 24px rgba(155, 92, 255, 0.48);
}

.launch-btn:active {
    transform: translateY(0);
}

.launch-btn .btn-icon {
    display: inline-block;
    transform: rotate(-8deg);
}

.btn-icon {
    font-size: 18px;
}

/* Loading */
.loading-container {
    display: none;
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 30px;
}

.loading-container.active {
    display: block;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(155, 92, 255, 0.18);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Orbitron', sans-serif;
    color: var(--primary-purple);
    font-size: 14px;
    letter-spacing: 2px;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Results */
.results-panel {
    display: none;
}

.results-panel.active {
    display: block;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.image-panel,
.data-panel {
    padding: 20px;
}

.image-container {
    position: relative;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 8px;
    overflow: hidden;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#apod-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}

#apod-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.4);
}

.image-date {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(18, 18, 20, 0.8);
    padding: 8px 15px;
    border: 1px solid var(--primary-purple);
    border-radius: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    color: var(--accent-aqua);
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glow-purple);
}

/* Data panel */
.data-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.data-field {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: rgba(20, 20, 22, 0.38);
    border-left: 3px solid var(--primary-purple);
    border-radius: 6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.data-field.full-width {
    flex-direction: column;
}

.field-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-aqua);
    letter-spacing: 1px;
    white-space: nowrap;
}

.field-value {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
}

.description-text {
    margin-top: 10px;
    line-height: 1.4;
    font-size: 16px;
    text-align: justify;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 12px 20px;
    background: rgba(155, 92, 255, 0.12);
    border: 1px solid var(--primary-purple);
    border-radius: 8px;
    color: var(--primary-purple);
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: rgba(155, 92, 255, 0.24);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 0 14px rgba(155, 92, 255, 0.28);
}

.action-btn--secondary {
    background: rgba(82, 247, 212, 0.08);
    border-color: var(--accent-aqua);
    color: var(--accent-aqua);
}

.action-btn--secondary:hover {
    background: rgba(82, 247, 212, 0.18);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(82, 247, 212, 0.22);
}

/* Footer */
.mission-footer {
    margin-top: 30px;
    padding: 20px;
    text-align: center;
}

.footer-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 5px 0;
}

.footer-content a {
    color: var(--primary-purple);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: var(--accent-aqua);
}

.footer-credits {
    font-size: 11px !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .control-interface {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .mission-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-left {
        flex-direction: column;
        gap: 10px;
    }

    .control-interface {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .input-group {
        text-align: center;
        min-width: 100%;
        margin-bottom: 0;
        flex: 1 1 auto;
    }

    .input-group label {
        text-align: center;
        margin-bottom: 6px;
    }

    .date-spinners {
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 0;
        gap: 10px;
    }

    .spinner-sep {
        display: none;
    }

    .quick-actions {
        width: 100%;
        justify-content: center;
        margin-top: -2px;
        gap: 10px;
    }

    .quick-btn {
        flex: 1;
    }

    .launch-btn {
        width: 100%;
        justify-content: center;
        margin-top: 0;
    }

    .logo-text {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        padding: 10px;
    }

    .control-main {
        padding: 20px 15px;
    }

    .panel-header h1 {
        font-size: 20px;
    }

    .panel-header h2 {
        font-size: 16px;
    }

    .date-control-panel {
        padding: 18px 14px;
    }

    .control-interface {
        gap: 8px;
    }

    .input-group {
        margin-bottom: 0;
    }

    .input-group label {
        margin-bottom: 4px;
    }

    .date-spinners {
        gap: 8px;
        margin-bottom: 0px;
    }

    .spinner-unit,
    .spinner-unit--wide {
        min-width: unset;
    }

    .spin-btn,
    .spinner-unit--wide .spin-btn {
        width: 84px;
    }

    .spin-display,
    .spinner-unit--wide .spin-display {
        width: 96px;
        height: 76px;
        font-size: 24px;
    }

    .quick-actions {
        gap: 8px;
        margin-top: -4px;
    }

    .quick-btn {
        padding: 10px 14px;
    }

    .action-buttons {
        flex-direction: column;
    }
}