/* ========================================
   Astralis — Thème nuit
   ======================================== */

@font-face {
    font-family: 'Orbitron';
    font-weight: 700;
    font-display: swap;
    src: url('orbitron-700.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-weight: 400;
    font-display: swap;
    src: url('inter-400.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-weight: 500;
    font-display: swap;
    src: url('inter-500.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-weight: 600;
    font-display: swap;
    src: url('inter-600.ttf') format('truetype');
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-input: #222233;
    --border: #2a2a3a;
    --text-primary: #d0d0dd;
    --text-secondary: #8888aa;
    --text-muted: #555566;
    --accent: #7B5FE7;
    --accent-hover: #8E75EF;
    --danger: #d94a4a;
    --success: #4ad97a;
    --warning: #d9a84a;
    --score-high: #4ad97a;
    --score-medium: #d9a84a;
    --score-low: #d94a4a;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg-primary);
}

body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ========== Navigation ========== */

/* Top bar */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

/* Desktop nav links in topbar */
.nav-links-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links-desktop .tab-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    transition: color 0.2s, background 0.2s;
}

.nav-links-desktop .tab-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-links-desktop .tab-link.active {
    color: var(--accent);
    background: rgba(123, 95, 231, 0.1);
}

/* Mobile night toggle (hidden on desktop) */
.mobile-only {
    display: none;
}

/* Bottom bar (hidden on desktop) */
#bottombar {
    display: none;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    #topbar {
        height: calc(48px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .nav-links-desktop {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    #bottombar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 100;
    }

    #app {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .home-controls {
        flex-wrap: wrap;
        gap: 6px;
    }

    .home-controls .form-group.inline {
        flex: 1 1 45%;
        min-width: 0;
    }

    .home-controls .form-group.inline select {
        font-size: 0.78rem;
        padding: 7px 6px;
        width: 100%;
    }

    .home-controls .form-group.inline label {
        font-size: 0.68rem;
    }

    .screen-header h1 {
        font-size: 1.3rem;
    }

    .screen-header p {
        font-size: 0.75rem;
    }
}

/* Tab links (bottom bar mobile) */
#bottombar .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 6px 8px;
    border-radius: 8px;
    transition: color 0.2s;
}

#bottombar .tab-link.active {
    color: var(--accent);
}

.tab-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.tab-icon-svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.tab-label {
    font-weight: 500;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-logo {
    width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
    object-fit: contain;
    border-radius: 50%;
}

.brand-name {
    font-family: 'Orbitron', sans-serif;
    color: #7B5FE7;
    text-shadow: 0 0 8px rgba(123, 95, 231, 0.6), 0 0 16px rgba(123, 95, 231, 0.3);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(74, 144, 217, 0.1);
}

/* ========== Main content ========== */

#app {
    padding-top: 56px;
    min-height: 100vh;
}

.screen {
    display: none;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

.screen.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 200;
    overflow-y: auto;
    padding: 40px 20px;
    max-width: 100%;
}

.screen.overlay.active {
    display: block;
}

.screen.overlay .overlay-header {
    max-width: 800px;
    margin: 0 auto;
}

.screen.overlay #detail-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 16px;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.screen-header {
    margin-bottom: 20px;
}

.screen-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.screen-header h2 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ========== Barre de recherche ========== */

.search-bar {
    position: relative;
    margin-bottom: 12px;
}

#search-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}

#search-input:focus {
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--text-muted);
}

.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
}

.search-dropdown.visible {
    display: block;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(123, 95, 231, 0.1);
}

.search-item.empty {
    color: var(--text-muted);
    cursor: default;
    justify-content: center;
}

.search-item-name {
    font-size: 0.88rem;
    font-weight: 500;
}

.search-item-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== Bouton recherche ========== */

.search-launcher {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.search-launcher.hidden {
    display: none;
}

.btn-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.btn-search:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(123, 95, 231, 0.3), 0 0 40px rgba(123, 95, 231, 0.15);
}

.btn-search-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    transition: transform 0.3s;
}

.btn-search:hover .btn-search-logo {
    transform: scale(1.05);
}

.btn-search span {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ========== Info bar ========== */

.info-bar {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========== Date + Moon bar ========== */

.title-date-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.title-date-row h1 {
    flex: 1;
    min-width: 0;
}

.seeing-moon-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.seeing-moon-box .seeing-bar {
    flex: 1;
    margin: 0;
}

.seeing-moon-box .seeing-row {
    border: none;
    background: none;
    padding: 0;
    height: auto;
}

.seeing-moon-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .seeing-moon-box {
        flex-direction: column;
        gap: 12px;
    }

    .seeing-moon-divider {
        width: 100%;
        height: 1px;
    }
}

.date-picker-wrap input[type="date"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}

.date-picker-wrap input[type="date"]:focus {
    border-color: var(--accent);
}

/* Moon visual */

.moon-visual {
    display: flex;
    align-items: center;
    gap: 12px;
}

.moon-icon-wrap {
    position: relative;
    width: 48px;
    height: 48px;
}

.moon-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 12px rgba(200, 200, 160, 0.15);
}

.moon-light {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #e8e4d4;
    transition: width 0.3s;
}

.moon-dark {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #1a1a26;
    transition: width 0.3s;
}

.moon-info {
    text-align: right;
}

.moon-phase-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.moon-phase-pct {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e8e4d4;
}

.moon-rise-set {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== Night summary ========== */

.night-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 12px;
    margin-bottom: 4px;
}

.night-summary-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 10px;
}

.night-summary-times {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.night-summary-block {
    text-align: center;
}

.night-summary-block .time {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.night-summary-block .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.night-summary-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.night-summary-duration {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    padding: 6px 0;
    flex: 1;
    background: linear-gradient(90deg, transparent, rgba(123, 95, 231, 0.15), transparent);
}

.night-summary-poses {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.night-summary-pose {
    text-align: center;
    background: var(--bg-card);
    border-radius: 6px;
    padding: 8px 4px;
}

.night-summary-pose .pose-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.night-summary-pose .pose-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.night-summary-pose.recommended {
    border: 2px solid #4caf50;
    background: rgba(76, 175, 80, 0.1);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.night-summary-pose .pose-recommended {
    font-size: 0.6rem;
    color: #4caf50;
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
}

.night-summary-reco-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

/* ========== Twilight bar ========== */

.twilight-bar {
    margin-top: 10px;
    margin-bottom: 4px;
}

.twilight-strip {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}

.twilight-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.twilight-segment.day       { background: #3b2d7a; }
.twilight-segment.civil     { background: #2a1e60; }
.twilight-segment.nautical  { background: #1c1348; }
.twilight-segment.astro     { background: #110a30; }
.twilight-segment.night     { background: #08051a; }

.twilight-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.twilight-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.twilight-group {
    display: flex;
    gap: 6px 14px;
}

.twilight-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.twilight-dot.sunset   { background: #3b2d7a; }
.twilight-dot.civil    { background: #2a1e60; }
.twilight-dot.nautical { background: #1c1348; }
.twilight-dot.astro    { background: #110a30; }

/* ========== Home controls ========== */

.home-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.home-controls .form-group.inline {
    flex: 1;
    margin-bottom: 0;
}

.home-controls .form-group.inline label {
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.home-controls .form-group.inline select {
    padding: 8px 10px;
    font-size: 0.85rem;
}

/* Seeing bar */
.seeing-bar {
    margin: 8px 0;
}

.seeing-loading {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.seeing-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    height: 100%;
    flex-wrap: wrap;
}

.seeing-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.seeing-main {
    flex-shrink: 0;
}

.seeing-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.seeing-value {
    font-weight: 700;
    font-size: 0.85rem;
}

.seeing-dots {
    display: flex;
    gap: 3px;
}

.seeing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.seeing-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.seeing-warn .seeing-value {
    color: #ff8c42;
}

.seeing-warn .seeing-label {
    color: #ff8c42;
}

.select-with-icon {
    display: flex;
    align-items: center;
    gap: 6px;
}

.select-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.select-with-icon select {
    flex: 1;
    min-width: 0;
}

/* ========== Favoris ========== */

.card-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-fav {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
}

.btn-fav:hover {
    color: #e74c6f;
    transform: scale(1.2);
}

.btn-fav.active {
    color: #e74c6f;
}

/* ========== Cards (liste de cibles) ========== */

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.overlay-header h1 {
    font-family: 'Orbitron', sans-serif;
}



.card-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.card-score {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.card-score:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(74, 217, 122, 0.4);
}


.card-score.high {
    background: rgba(74, 217, 122, 0.15);
    color: var(--score-high);
}

.card-score.medium {
    background: rgba(217, 168, 74, 0.15);
    color: var(--score-medium);
}

.card-score.low {
    background: rgba(217, 74, 74, 0.15);
    color: var(--score-low);
}

.card-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

/* ========== Top Picks ========== */

.top-picks {
    margin-bottom: 20px;
}

.top-picks-header,
.discoveries-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.top-picks-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--score-high);
    padding-left: 4px;
    letter-spacing: 0.3px;
}

.shuffle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.shuffle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(180deg);
}

body.night-red .shuffle-btn:hover {
    color: #cc3333;
    border-color: #cc3333;
}

.top-picks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card.top-pick {
    border: 1.5px solid var(--score-high);
    box-shadow: 0 0 10px rgba(74, 217, 122, 0.1);
}

.card.top-pick:hover {
    border-color: var(--score-high);
    box-shadow: 0 0 14px rgba(74, 217, 122, 0.2);
}

body.night-red .card.top-pick {
    border-color: #883322;
    box-shadow: 0 0 10px rgba(136, 51, 34, 0.15);
}

/* Discoveries */

.discoveries {
    margin-bottom: 20px;
}

.discoveries-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--score-medium);
    padding-left: 4px;
    letter-spacing: 0.3px;
}

.discoveries-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card.discovery {
    border: 1.5px solid var(--score-medium);
    box-shadow: 0 0 10px rgba(217, 168, 74, 0.1);
}

.card.discovery:hover {
    border-color: var(--score-medium);
    box-shadow: 0 0 14px rgba(217, 168, 74, 0.2);
}

body.night-red .card.discovery {
    border-color: #664422;
    box-shadow: 0 0 10px rgba(102, 68, 34, 0.15);
}

/* Card body layout */

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

.card-info {
    flex: 1;
    min-width: 0;
}

.card-framing {
    flex-shrink: 0;
    background: rgba(10, 10, 15, 0.5);
    border-radius: 4px;
    padding: 2px;
    border: 1px solid var(--border);
}

.card-framing svg {
    display: block;
}

.framing-preview-large {
    display: flex;
    justify-content: center;
    background: rgba(5, 5, 10, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    margin-bottom: 16px;
}

.framing-preview-large svg {
    display: block;
}

.score-framing-section {
    margin-bottom: 4px;
}

/* Catalog badges */

.cat-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.3px;
}

.cat-messier { background: rgba(74, 217, 122, 0.2); color: #4ad97a; }
.cat-ngc     { background: rgba(74, 144, 217, 0.2); color: #4a90d9; }
.cat-ic      { background: rgba(138, 74, 217, 0.2); color: #b88adb; }
.cat-sh2     { background: rgba(217, 74, 74, 0.2); color: #d97a7a; }
.cat-barnard { background: rgba(160, 140, 100, 0.2); color: #a08c64; }
.cat-other   { background: rgba(100, 100, 100, 0.2); color: #888; }

body.night-red .cat-messier,
body.night-red .cat-ngc,
body.night-red .cat-ic,
body.night-red .cat-sh2,
body.night-red .cat-barnard {
    background: rgba(120, 40, 40, 0.2);
    color: #aa4444;
}

/* Magnitude dots */

.mag-dots {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.mag-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.mag-dot.filled {
    background: #e8c84a;
    box-shadow: 0 0 3px rgba(232, 200, 74, 0.5);
}

.mag-dot.empty {
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.card-reason {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* ========== Forms ========== */

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ========== Buttons ========== */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-input);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

/* ========== Settings sections ========== */

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.settings-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 14px;
}

/* ========== Setup list ========== */

.setup-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setup-item-info {
    flex: 1;
}

.setup-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.setup-item-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.setup-item-actions {
    display: flex;
    gap: 8px;
}

/* ========== Checklist ========== */

.checklist-group {
    margin-bottom: 16px;
}

.checklist-group-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checklist-item.checked label {
    color: var(--text-muted);
    text-decoration: line-through;
}

.checklist-item label {
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}

.checklist-item .required {
    color: var(--warning);
    font-size: 0.75rem;
    font-weight: 600;
}

.checklist-item.important {
    background: rgba(255, 170, 0, 0.1);
    border-left: 3px solid #ffaa00;
    padding-left: 8px;
    border-radius: 4px;
}

.checklist-item.important label {
    color: #ffaa00;
    font-weight: 600;
}

.checklist-item.important.checked label {
    color: var(--text-muted);
}

.checklist-item.critical {
    background: rgba(220, 40, 40, 0.1);
    border-left: 3px solid #dc2828;
    padding-left: 8px;
    border-radius: 4px;
}

.checklist-item.critical label {
    color: #dc2828;
    font-weight: 600;
}

.checklist-item.critical.checked label {
    color: var(--text-muted);
}

.checklist-progress {
    margin-bottom: 16px;
}

.checklist-progress-bar {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.checklist-progress-fill {
    height: 100%;
    background: #4caf50;
    border-radius: 4px;
    transition: width 0.3s;
}

.checklist-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.checklist-group-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.checklist-group.done .checklist-group-title {
    color: #4caf50;
}

/* ========== Guide cameras ========== */

.guide-cameras {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guide-camera {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.guide-camera-photo {
    width: 80px;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.guide-camera-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-camera-priority {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.guide-camera-priority.fallback {
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
}

/* ========== Système solaire ========== */

.solar-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.solar-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.solar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.solar-card.high {
    border-left: 3px solid #4caf50;
}

.solar-card.medium {
    border-left: 3px solid #ffaa00;
}

.solar-card.low {
    border-left: 3px solid #ff5555;
}

.solar-card.hidden {
    opacity: 0.5;
    border-left: 3px solid var(--border);
}

.solar-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.solar-emoji {
    font-size: 1.3rem;
}

.solar-name {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
}

.solar-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.solar-status.high {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.solar-status.medium {
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
}

.solar-status.low {
    background: rgba(255, 85, 85, 0.15);
    color: #ff5555;
}

.solar-status.hidden {
    background: rgba(128, 128, 128, 0.1);
    color: var(--text-muted);
}

.solar-card-body {
    padding-top: 4px;
}

.solar-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    font-size: 0.85rem;
}

.solar-dl dt {
    color: var(--text-secondary);
}

.solar-dl dd {
    color: var(--text-primary);
}

.solar-extra {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

.solar-extra.warning {
    color: #ff5555;
}

.solar-constellation {
    font-size: 0.7rem;
    color: var(--accent);
    opacity: 0.7;
    font-style: italic;
}

.altitude-curve {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 6px;
}

.altitude-curve-svg {
    width: 100%;
    height: auto;
}

.solar-section {
    margin-bottom: 24px;
}

.solar-section h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 12px;
}

/* Calendrier lunaire (ligne) */

.moon-calendar-line {
    margin-top: 12px;
    padding: 4px 0;
}

.moon-calendar-title {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-transform: capitalize;
}

.moon-cal-strip {
    display: flex;
    justify-content: space-between;
}

.moon-cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    border-radius: 4px;
    padding: 2px 1px;
}

.moon-cal-cell.today {
    background: rgba(123, 95, 231, 0.15);
}

.moon-cal-cell.selected {
    background: rgba(123, 95, 231, 0.25);
}

.moon-cal-num {
    font-size: 0.55rem;
    color: var(--text-muted);
    line-height: 1;
}

.moon-cal-emoji {
    font-size: 0.7rem;
    line-height: 1;
}

/* Événements lunaires */

.moon-events {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.moon-event {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 3px 8px;
    border-radius: 4px;
}

/* ========== Overlay detail ========== */

.overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.overlay-header h1 {
    font-size: 1.15rem;
}

#detail-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.detail-section {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-links {
    display: flex;
    gap: 10px;
}

.detail-links .btn {
    flex: 1;
    text-align: center;
}

.detail-section h2 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    font-size: 0.88rem;
}

.detail-grid dt {
    color: var(--text-secondary);
}

.detail-grid dd {
    color: var(--text-primary);
    font-weight: 500;
}

/* Courbe d'altitude */

.alt-curve-wrap {
    margin-bottom: 10px;
}

.alt-curve-svg {
    width: 100%;
    height: auto;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 4px;
}

.alt-curve-legend {
    display: flex;
    justify-content: center;
    gap: 14px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.alt-legend-green {
    color: #4caf50;
}

.alt-legend-red {
    color: #ff5555;
}

.alt-legend-line {
    color: var(--accent);
}

#aladin-container {
    width: 100%;
    height: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

/* ========== Placeholder ========== */

.placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* ========== Responsive ========== */

@media (max-width: 480px) {

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Setup detail cards ========== */

.setup-detail-sensor {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.sensor-photo {
    display: block;
    width: 140px;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    margin: 12px auto 0;
}

.setup-photo {
    display: block;
    width: 140px;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    margin: 12px auto 0;
}

.setup-detail-sensor h2 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.setup-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.setup-detail-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.setup-detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setup-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0;
    opacity: 0.4;
}

.setup-detail-header .setup-photo {
    display: block;
    width: 100px;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    margin: 0;
    text-align: left;
}

.setup-detail-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.setup-detail-type {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(74, 144, 217, 0.12);
    color: var(--accent);
}

.setup-detail-section {
    margin-bottom: 12px;
}

.setup-detail-section h3 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 600;
}

.setup-detail-targets,
.setup-detail-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setup-detail-filter-note {
    font-size: 0.8rem;
    color: var(--warning);
    margin-top: 4px;
    font-style: italic;
}

/* ========== Setup filter rows ========== */

.setup-filter-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.setup-filter-row:last-child {
    border-bottom: none;
}

.setup-filter-name {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.setup-filter-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.setup-filter-type {
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.setup-filter-type.narrowband {
    background: rgba(138, 74, 217, 0.15);
    color: #b88adb;
}

.setup-filter-type.broadband {
    background: rgba(74, 217, 176, 0.15);
    color: #6ad9b0;
}

.setup-filter-channels {
    color: var(--accent);
    font-weight: 500;
}

.setup-filter-bandpass {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
}

.setup-filter-combo {
    font-size: 0.78rem;
    color: var(--warning);
    margin-top: 3px;
    font-style: italic;
}

/* ========== Modal ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    flex: 1;
}

.modal-header .btn-icon {
    font-size: 1.6rem;
    color: var(--text-secondary);
}

/* Score breakdown */

.score-profile {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(74, 144, 217, 0.15);
    color: var(--accent);
    margin-bottom: 14px;
}

.score-total {
    text-align: center;
    margin-bottom: 18px;
}

.score-total-value {
    font-size: 2.4rem;
    font-weight: 700;
}

.score-total-value.high { color: var(--score-high); }
.score-total-value.medium { color: var(--score-medium); }
.score-total-value.low { color: var(--score-low); }

.score-total-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-row {
    margin-bottom: 12px;
}

.score-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.score-row-label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.score-row-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.score-bar {
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.score-bar-fill.high { background: var(--score-high); }
.score-bar-fill.medium { background: var(--score-medium); }
.score-bar-fill.low { background: var(--score-low); }

.score-row-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Tips */

.score-tips {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.score-tips h3 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 8px;
}

.score-tip {
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 6px 0;
    padding-left: 12px;
    border-left: 2px solid var(--accent);
    margin-bottom: 6px;
}

.score-warnings {
    margin-top: 12px;
}

.score-warning {
    font-size: 0.82rem;
    color: var(--warning);
    padding: 6px 0;
    padding-left: 12px;
    border-left: 2px solid var(--warning);
    margin-bottom: 6px;
}

/* ========== Night mode toggle ========== */

.night-mode-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.night-mode-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

body.night-red .night-mode-btn {
    color: #cc3333;
    border-color: #cc3333;
    background: rgba(204, 51, 51, 0.1);
}

/* ========== Night red mode ========== */

body.night-red {
    --bg-primary: #0a0000;
    --bg-secondary: #120000;
    --bg-card: #1a0505;
    --bg-input: #220808;
    --border: #3a1010;
    --text-primary: #cc4444;
    --text-secondary: #883333;
    --text-muted: #552222;
    --accent: #cc3333;
    --accent-hover: #dd4444;
    --score-high: #cc4444;
    --score-medium: #aa3333;
    --score-low: #662222;
    --warning: #aa4422;
    --success: #883322;
}

body.night-red .brand-name {
    color: #cc3333;
    text-shadow: 0 0 8px rgba(204, 51, 51, 0.5);
}

body.night-red .card-score.high {
    background: rgba(204, 68, 68, 0.15);
    color: #cc4444;
}

body.night-red .card-score.medium {
    background: rgba(170, 51, 51, 0.15);
    color: #aa3333;
}

body.night-red .card-score.low {
    background: rgba(102, 34, 34, 0.15);
    color: #662222;
}

body.night-red .mag-dot.filled {
    background: #cc4444;
    box-shadow: 0 0 3px rgba(204, 68, 68, 0.4);
}

body.night-red .moon-phase-pct {
    color: #cc4444;
}

body.night-red .setup-filter-type.narrowband {
    background: rgba(170, 51, 51, 0.15);
    color: #aa4444;
}

body.night-red .setup-filter-type.broadband {
    background: rgba(170, 68, 51, 0.15);
    color: #aa5544;
}

body.night-red .twilight-segment.day     { background: #3a1515; }
body.night-red .twilight-segment.civil   { background: #2a0e0e; }
body.night-red .twilight-segment.nautical { background: #1a0808; }
body.night-red .twilight-segment.astro   { background: #100404; }
body.night-red .twilight-segment.night   { background: #080202; }

body.night-red .score-bar-fill.high   { background: #cc4444; }
body.night-red .score-bar-fill.medium { background: #aa3333; }
body.night-red .score-bar-fill.low    { background: #662222; }

body.night-red .night-summary-pose.recommended {
    border-color: #cc3333;
    background: rgba(204, 51, 51, 0.08);
}

body.night-red img {
    filter: saturate(0) brightness(0.6) sepia(1) hue-rotate(-30deg);
}

/* ========== Scrollbar ========== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
