/* ============================================================
   DDS DARK THEME — Satellite Tracker
   Dubai Design System v3.12.10
   data-theme="dark" must be set on <body> or <html>
============================================================ */

/* ── Prevent horizontal overflow only ───────────────────── */
html, body {
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

/* ── 1. Dubai Font — Self-Hosted ─────────────────────────── */
@font-face {
    font-family: 'Dubai';
    src: url('../fonts/Dubai-Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'Dubai';
    src: url('../fonts/Dubai-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Dubai';
    src: url('../fonts/Dubai-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Dubai';
    src: url('../fonts/Dubai-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}


/* ── 2. DDS Color Token Overrides (Dark Surface Palette) ─── */
:root {
    /* DDS Primary (Teal-Blue) */
    --dda-primary-40:  #006A67;
    --dda-primary-60:  #00A19E;
    --dda-primary-70:  #21BEBA;
    --dda-primary-80:  #4DDAD6;
    --dda-primary-90:  #6FF7F2;
    --dda-primary-95:  #D0F5F4;

    /* DDS Secondary (Indigo-Blue) */
    --dda-secondary-30: #2E4090;
    --dda-secondary-40: #4758A9;
    --dda-secondary-60: #7A8BE0;
    --dda-secondary-70: #95A6FD;
    --dda-secondary-80: #B9C3FF;

    /* Dark Surface Tokens */
    --dda-surface:          #0f172a;   /* deepest background */
    --dda-surface-variant:  #1e293b;   /* card background    */
    --dda-surface-container:#1a2744;   /* elevated container */
    --dda-on-surface:       #f1f5f9;   /* primary text       */
    --dda-on-surface-var:   #94a3b8;   /* secondary text     */
    --dda-outline:          rgba(77, 218, 214, 0.25); /* borders */
    --dda-outline-variant:  rgba(77, 218, 214, 0.12);

    /* Semantic */
    --dda-success:  #10b981;
    --dda-warning:  #f59e0b;
    --dda-error:    #dc2626;

    /* Legacy aliases (keeps JS working without changes) */
    --primary-blue:    var(--dda-primary-70);
    --secondary-blue:  var(--dda-primary-60);
    --light-blue:      rgba(77, 218, 214, 0.15);
    --dark-blue:       var(--dda-primary-40);
    --accent-gold:     #fbbf24;
    --mars-red:        var(--dda-error);
    --success-green:   var(--dda-success);
    --warning-orange:  var(--dda-warning);
    --space-black:     var(--dda-surface);
    --cosmic-purple:   var(--dda-secondary-60);

    /* Bootstrap overrides */
    --bs-body-color:       var(--dda-on-surface) !important;
    --bs-secondary-color:  var(--dda-on-surface-var) !important;
}

/* ── 3. Animated Star Background ────────────────────────── */
.stars-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
}

.stars, .stars2, .stars3 {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: transparent;
}

.stars {
    background-image:
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #ddd, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: zoom 20s infinite linear;
    opacity: 0;
}

.stars2 {
    background-image:
        radial-gradient(1px 1px at 40px 60px, #fff, transparent),
        radial-gradient(1px 1px at 120px 10px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 160px 90px, #eee, transparent),
        radial-gradient(2px 2px at 200px 40px, rgba(255,255,255,0.7), transparent);
    background-repeat: repeat;
    background-size: 250px 120px;
    animation: zoom 40s infinite linear;
    opacity: 0;
}

.stars3 {
    background-image:
        radial-gradient(1px 1px at 10px 10px, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 60px 80px, #fff, transparent),
        radial-gradient(1px 1px at 100px 50px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 180px 20px, #ddd, transparent);
    background-repeat: repeat;
    background-size: 300px 150px;
    animation: zoom 60s infinite linear;
    opacity: 0;
}

@keyframes zoom {
    0%   { opacity: 0; transform: scale(0.5); }
    50%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.2); }
}

/* ── 4. Body & Layout ────────────────────────────────────── */
body {
    background: linear-gradient(
        135deg,
        var(--dda-surface)          0%,
        #1a2744                     30%,
        #1e293b                     60%,
        #263348                    100%
    );
    background-attachment: fixed;
    font-family: 'Dubai', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dda-on-surface);
    overflow-x: hidden;
    margin: 0;
    padding: 20px;
    padding-bottom: 20px !important;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ── 5. Navigation ───────────────────────────────────────── */
.navbar {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1px solid var(--dda-outline);
}

.navbar-brand {
    font-family: 'Dubai', sans-serif;
    font-weight: 700;
    color: var(--dda-primary-80);
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

.navbar-brand span {
    font-family: 'Dubai', sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--dda-on-surface);
}

.navbar-brand img {
    display: inline-block;
    vertical-align: middle;
}

/* ── 6. Satellite Tabs ───────────────────────────────────── */
.satellite-tabs {
    background: rgba(30, 41, 59, 0.85);
    border-radius: 14px;
    padding: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--dda-outline);
}

.satellite-tabs .nav-link {
    background: transparent;
    border: 1px solid var(--dda-outline);
    color: var(--dda-on-surface);
    border-radius: 10px;
    margin: 0 4px;
    font-family: 'Dubai', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    transition: all 0.25s ease;
}

.satellite-tabs .nav-link:hover {
    background: rgba(77, 218, 214, 0.12);
    border-color: var(--dda-primary-80);
    color: var(--dda-primary-80);
    transform: translateY(-2px);
}

.satellite-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--dda-primary-60), var(--dda-secondary-60));
    border-color: var(--dda-primary-70);
    color: #fff;
    box-shadow: 0 4px 16px rgba(77, 218, 214, 0.25);
}

/* ── 7. Cards ────────────────────────────────────────────── */
.card {
    background: rgba(30, 41, 59, 0.92);
    border: 1px solid var(--dda-outline);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    margin-bottom: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.card-header {
    background: linear-gradient(135deg, var(--dda-primary-60), var(--dda-secondary-60));
    color: #fff;
    border-radius: 18px 18px 0 0 !important;
    font-family: 'Dubai', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    height: 60px;
    padding: 0 20px;
    flex-shrink: 0;
}

.fullscreen-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.fullscreen-btn:hover {
    opacity: 1;
    transform: scale(1.12);
}

/* ── 8. Metric Cards ─────────────────────────────────────── */
.metric-card {
    background: linear-gradient(135deg, var(--dda-primary-40), var(--dda-secondary-40));
    color: #fff;
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 20px;
    height: 100%;
    border: 1px solid var(--dda-outline);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(77, 218, 214, 0.2);
}

.metric-card h3 {
    font-family: 'Dubai', sans-serif;
    font-weight: 700;
    font-size: 2.4rem;
    margin: 0;
    letter-spacing: -0.02em;
}

.metric-card p,
.metric-card small {
    font-family: 'Dubai', sans-serif;
    font-weight: 400;
    color: rgba(255,255,255,0.85);
}

/* ── 9. Map Controls (DDS-styled buttons) ────────────────── */
.map-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

/* Native fallback — used when dda-button is not available */
.btn-control {
    background: rgba(77, 218, 214, 0.08);
    border: 1px solid var(--dda-outline);
    color: var(--dda-primary-80);
    padding: 8px 18px;
    border-radius: 20px;
    font-family: 'Dubai', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.25s ease;
    cursor: pointer;
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.btn-control:hover {
    background: rgba(77, 218, 214, 0.18);
    border-color: var(--dda-primary-80);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(77, 218, 214, 0.2);
}

.btn-control.active {
    background: rgba(77, 218, 214, 0.25);
    border-color: var(--dda-primary-80);
    color: var(--dda-primary-90);
    box-shadow: 0 0 12px rgba(77, 218, 214, 0.3);
}

/* dda-button dark mode wrapper */
.map-controls dda-button {
    --component-mode: dark;
}

/* ── 10. Satellite Info Panel ────────────────────────────── */
.satellite-info {
    font-family: 'Dubai', sans-serif;
    font-size: 0.9rem;
}

.satellite-info .data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--dda-outline-variant);
    padding-bottom: 10px;
}

.satellite-info .label {
    color: var(--dda-primary-80);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}

.satellite-info .value {
    font-weight: 700;
    color: var(--dda-on-surface);
}

/* ── 11. TLE Data Block ──────────────────────────────────── */
.tle-data {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: rgba(77, 218, 214, 0.07);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--dda-primary-80);
    word-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    max-width: 100%;
    color: var(--dda-primary-90);
}

.tle-line {
    margin-bottom: 5px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(77, 218, 214, 0.15);
}

.tle-line:last-child {
    border-bottom: none;
}

/* ── 12. Pass Prediction Table ───────────────────────────── */
.pass-table {
    width: 100%;
    color: var(--dda-on-surface);
    font-family: 'Dubai', sans-serif;
}

.pass-table th {
    color: var(--dda-primary-80);
    font-family: 'Dubai', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--dda-outline);
    padding: 14px 10px;
    text-align: center;
}

.pass-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--dda-outline-variant);
    text-align: center;
    font-size: 0.9rem;
}

.pass-table tbody tr:hover {
    background: rgba(77, 218, 214, 0.07);
}

/* ── 13. Visibility Badges ───────────────────────────────── */
.visibility-excellent { color: var(--dda-success);    font-weight: 700; }
.visibility-good      { color: var(--dda-primary-80); font-weight: 700; }
.visibility-fair      { color: var(--dda-warning);    font-weight: 700; }
.visibility-poor      { color: var(--dda-error);      font-weight: 700; }

/* ── 14. Footer ──────────────────────────────────────────── */
.footer {
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid var(--dda-outline);
    padding: 20px 0;
    margin-top: 50px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 14px 14px 0 0;
    font-family: 'Dubai', sans-serif;
}

.footer p {
    margin: 0;
    color: var(--dda-on-surface-var);
    font-size: 0.9rem;
}

/* ── 15. Animation Utilities ─────────────────────────────── */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ── 16. Equal-Height Layout ─────────────────────────────── */
.satellite-row {
    display: flex !important;
    align-items: stretch !important;
    min-height: 600px;
    gap: 15px;
}

.map-column {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.info-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.map-card,
.satellite-info-card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.map-card .card-body,
.satellite-info-card .card-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.satellite-map {
    flex: 1 !important;
    min-height: 400px !important;
    height: auto !important;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.satellite-info-card .card-body {
    overflow-y: auto;
    padding: 20px;
}

.metrics-row {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.pass-table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}

/* ── 17. Leaflet Logo Control ────────────────────────────── */
.leaflet-logo {
    background: transparent !important;
    border: none !important;
    margin: 10px !important;
}

.leaflet-logo img {
    transition: all 0.3s ease;
    border-radius: 8px;
}

.leaflet-logo:hover img {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(77, 218, 214, 0.35);
    filter: brightness(1.1);
}

/* Hide old overlay (replaced by Leaflet control) */
.mbrsc-logo-overlay { display: none; }

/* ── 18. Day/Night Overlay ───────────────────────────────── */
.day-night-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 400;
}

.night-area      { fill: rgba(0, 0, 0, 0.4); stroke: none; }
.terminator-line { stroke: #ff6b35; stroke-width: 2; fill: none; stroke-dasharray: 5,5; }

/* ── 19. Custom Scrollbar ────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--dda-primary-60); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--dda-primary-70); }

/* ── 20. Responsive ──────────────────────────────────────── */
@media (max-width: 991px) {
    .satellite-row {
        flex-direction: column !important;
        min-height: auto !important;
        gap: 20px;
    }

    .map-column,
    .info-column {
        flex: none !important;
    }

    .map-card,
    .satellite-info-card {
        height: auto !important;
        min-height: 500px;
    }

    .satellite-map {
        min-height: 400px !important;
    }

    .map-controls {
        flex-direction: column;
    }

    .btn-control {
        width: 100%;
        margin-bottom: 5px;
        min-width: 100px;
        font-size: 0.85rem;
        padding: 6px 14px;
    }

    .metric-card h3 {
        font-size: 2rem;
    }

    .satellite-tabs .nav-link {
        margin: 2px;
        font-size: 0.85rem;
    }
}

@media (min-width: 992px) {
    .satellite-row .col-lg-8,
    .satellite-row .col-lg-4 {
        width: auto !important;
        max-width: none !important;
    }

    .map-column  { padding-right: 10px; }
    .info-column { padding-left:  10px; }
}

@media (max-width: 992px) {
    .col-lg-8, .col-lg-4 { margin-bottom: 20px; }
    .leaflet-logo img     { width: 60px !important; }
}

/* ============================================================
   MOBILE RESPONSIVE — Satellite Tracker
   Breakpoint: 767px and below
============================================================ */

/* ── Tabs ─────────────────────────────────────────────────── */
@media (max-width: 767px) {

  /* Scrollable single-row tabs — no wrapping */
  #satelliteTabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 4px;
    margin-bottom: 16px !important;
  }

  #satelliteTabs::-webkit-scrollbar {
    display: none;
  }

  #satelliteTabs .nav-item {
    flex: 0 0 auto;
  }

  #satelliteTabs .nav-link {
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  /* ── Metric Cards — 2 column grid ───────────────────────── */
  .metrics-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px !important;
  }

  .metrics-row > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .metric-card {
    padding: 14px !important;
    border-radius: 12px !important;
  }

  .metric-card h3 {
    font-size: 1.2rem !important;
  }

  .metric-card h5 {
    font-size: 0.8rem !important;
  }

  .metric-card .mt-3 {
    font-size: 0.75rem;
    margin-top: 6px !important;
  }

  /* ── Map — full width, comes FIRST on mobile ────────────── */
  .satellite-row {
    display: flex !important;
    flex-direction: column !important;
  }

  .map-column {
    order: 1;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-bottom: 12px;
  }

  .info-column {
    order: 2;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Map height — compact but usable */
  .satellite-map {
    height: 280px !important;
  }

  /* ── Map control buttons — scrollable row ───────────────── */
  .map-controls {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px !important;
    padding: 8px !important;
  }

  .map-controls::-webkit-scrollbar {
    display: none;
  }

  .btn-control {
    flex: 0 0 auto !important;
    font-size: 0.75rem !important;
    padding: 5px 10px !important;
    white-space: nowrap !important;
  }

  /* ── Satellite Info Card — compact ──────────────────────── */
  .satellite-info .data-row {
    padding: 6px 0 !important;
    font-size: 0.85rem !important;
  }

  /* ── Passes Table — horizontal scroll ───────────────────── */
  .pass-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .pass-table {
    min-width: 560px;
  }

  /* ── General spacing ────────────────────────────────────── */
  .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .card-header {
    font-size: 0.85rem !important;
    padding: 10px 14px !important;
  }
}

/* ── Small phones (< 400px) ───────────────────────────────── */
@media (max-width: 400px) {

  .metrics-row {
    grid-template-columns: 1fr;
  }

  .satellite-map {
    height: 240px !important;
  }

  #satelliteTabs .nav-link {
    font-size: 0.8rem;
    padding: 7px 12px;
  }
}