/* =====================================================
   4_eBike / 01_eBikeDashboard.css
   3D_Ultra - Bosch eBike Live Data Frontend
   Aufgabe: Nur Anzeige + Bedienoberfläche, keine BLE/API Logik.
   Backend schreibt JSON in /DataExchange/eBike_Status.json
   ===================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(28, 116, 169, 0.25), transparent 34%),
        radial-gradient(circle at bottom right, rgba(30, 179, 117, 0.15), transparent 40%),
        #07111f;
    color: #e8f4ff;
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

/* =====================================================
   Kopfbereich
   ===================================================== */

.ultra-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    background: rgba(7, 17, 31, 0.92);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #ffffff;
    min-width: 180px;
}

.logo-main {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -1px;
}

.logo-sub {
    font-size: 11px;
    color: #8fb5d8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.header-title {
    flex: 1;
    text-align: center;
}

.header-title h1 {
    font-size: 18px;
    letter-spacing: 0.5px;
    font-weight: 800;
}

.header-title div {
    margin-top: 3px;
    font-size: 12px;
    color: #8fb5d8;
}

.header-status {
    min-width: 220px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cde7ff;
}

.led {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #6d788a;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}

.led.online { background: #00d084; box-shadow: 0 0 14px rgba(0,208,132,0.8); }
.led.mock { background: #ffb020; box-shadow: 0 0 14px rgba(255,176,32,0.7); }
.led.offline { background: #ff4d4d; box-shadow: 0 0 14px rgba(255,77,77,0.7); }

/* =====================================================
   Layout
   ===================================================== */

.page {
    width: min(1240px, calc(100vw - 36px));
    margin: 26px auto 36px;
    display: grid;
    grid-template-columns: 390px 1fr;
    gap: 22px;
}

.panel {
    background: linear-gradient(145deg, rgba(14, 31, 52, 0.96), rgba(8, 18, 33, 0.97));
    border: 1px solid rgba(157, 205, 255, 0.14);
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
}

.panel-header {
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.045);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #cbe7ff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    font-weight: 800;
}

.panel-body { padding: 18px; }

/* =====================================================
   eBike Hauptinstrument
   ===================================================== */

.bike-card {
    position: relative;
    min-height: 640px;
}

.ble-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 0 2px;
}

.ble-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.4s;
}

.ble-label.online {
    color: #00d084;
}

.led.big {
    width: 16px;
    height: 16px;
}

.bike-visual {
    margin: 8px auto 20px;
    width: 280px;
    height: 185px;
    position: relative;
}

.wheel {
    position: absolute;
    bottom: 8px;
    width: 86px;
    height: 86px;
    border: 8px solid rgba(126, 203, 255, 0.72);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08), 0 0 18px rgba(126,203,255,0.12);
}

.wheel.front { right: 18px; }
.wheel.back { left: 18px; }

.frame-line {
    position: absolute;
    height: 7px;
    background: linear-gradient(90deg, #2cd98f, #7ecbff);
    border-radius: 8px;
    transform-origin: left center;
    box-shadow: 0 0 14px rgba(44,217,143,0.22);
}

/* ── Bosch MTB-Style Geometrie (280×185 px) ──────────────────
   Hinterrad-Mitte : (61,  51)   Vorderrad-Mitte: (219, 51)
   BB/Motor-Mitte  : (130, 52)   Sattelkopf     : (115, 156)
   Steuerrohr oben : (190, 148)
   ─────────────────────────────────────────────────────────── */

/* Kettenstrebe – Hinterrad → BB  (fast waagerecht) */
.line-1 { left: 61px;  bottom: 48px;  width: 69px;  transform: rotate(0deg);   }
/* Sitzrohr – Sattelkopf → BB  (82°, 40% kürzer → 62px) */
.line-2 { left: 121px; bottom: 107px; width: 62px;  transform: rotate(82deg);  }
/* Oberrohr – Sattelkopf → Steuerrohr  (leicht ansteigend, -29°) */
.line-3 { left: 121px; bottom: 107px; width: 79px;  transform: rotate(-29deg); }
/* Unterrohr – BB → Steuerrohr  (Hauptdiagonale, -58°) */
.line-4 { left: 130px; bottom: 48px;  width: 114px; transform: rotate(-58deg); }
/* Gabel – Steuerrohr → Vorderrad  (steil, 73°) */
.handle { left: 190px; bottom: 145px; width: 101px; transform: rotate(73deg);  }
/* Sattel */
.seat   { left: 103px; bottom: 112px; width: 56px;  transform: rotate(0deg);
          background: #94a8bc; border-radius: 10px; }

.motor-dot {
    position: absolute;
    left: 113px;
    bottom: 35px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #18293d;
    border: 3px solid #2cd98f;
    box-shadow: 0 0 22px rgba(44,217,143,0.35);
}

/* Lenker (T-Form am Steuerrohr) */
.bike-visual::after {
    content: "";
    position: absolute;
    left: 181px;
    bottom: 148px;
    width: 34px;
    height: 7px;
    background: linear-gradient(90deg, #2cd98f, #7ecbff);
    border-radius: 8px;
    transform: rotate(-8deg);
    box-shadow: 0 0 14px rgba(44,217,143,0.22);
}

.battery-block {
    margin: 0 auto 18px;
    width: 242px;
    height: 92px;
    border-radius: 16px;
    background: #050b13;
    border: 2px solid rgba(255,255,255,0.16);
    padding: 10px;
    position: relative;
    box-shadow: inset 0 0 24px rgba(0,0,0,0.8);
}

.battery-block::after {
    content: "";
    position: absolute;
    right: -12px;
    top: 28px;
    width: 10px;
    height: 34px;
    border-radius: 0 6px 6px 0;
    background: rgba(255,255,255,0.20);
}

.battery-fill {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    background: linear-gradient(90deg, #2cd98f, #9bf7c9);
    transition: width 0.4s ease;
}

.battery-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.75);
}

.big-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.big-value {
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    padding: 14px;
}

.big-value .label {
    font-size: 11px;
    color: #87aeca;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.big-value .value {
    margin-top: 6px;
    font-size: 29px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.big-value .unit {
    font-size: 13px;
    color: #8fb5d8;
    margin-left: 3px;
}

.status-line {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0,0,0,0.22);
    color: #c8dff4;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.08);
}

/* =====================================================
   Datenraster
   ===================================================== */

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.data-tile {
    min-height: 126px;
    border-radius: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.10);
    position: relative;
    overflow: hidden;
}

.data-tile::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, #2cd98f, #7ecbff);
    opacity: 0.85;
}

.data-tile .caption {
    color: #87aeca;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-tile .number {
    margin-top: 12px;
    font-size: 32px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.data-tile .small-unit {
    font-size: 13px;
    color: #8fb5d8;
    margin-left: 3px;
}

.data-tile .hint {
    margin-top: 9px;
    font-size: 12px;
    color: #8fb5d8;
}

.architecture {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.arch-box {
    padding: 16px;
    border-radius: 14px;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.09);
}

.arch-box h3 {
    font-size: 13px;
    color: #ffffff;
    margin-bottom: 8px;
}

.arch-box p {
    font-size: 12px;
    line-height: 1.45;
    color: #9fbed8;
}

.footer-note {
    margin-top: 18px;
    color: #8fb5d8;
    font-size: 12px;
    line-height: 1.45;
}

/* =====================================================
   eBike Connect Panel
   ===================================================== */

/* Connect-Zeile: LED links, Buttons rechts */
.connect-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.connect-status-indicator {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.connect-status-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    white-space: nowrap;
    transition: color 0.4s;
}

.connect-status-label.online { color: #00d084; }

.start-hint {
    font-size: 9px;
    font-family: 'Courier New', monospace;
    color: rgba(255, 255, 255, 0.22);
    text-align: center;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.connect-btn-group {
    flex: 0 0 48%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ebike-connect-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 13px;
    background: linear-gradient(135deg, #00c97a, #00a85a);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 200, 110, 0.38);
    transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}

.ebike-connect-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(0, 200, 110, 0.52);
}

.ebike-connect-btn:active:not(:disabled) { transform: translateY(0); }

.ebike-connect-btn:disabled {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.22);
    box-shadow: none;
    cursor: not-allowed;
}

.ebike-stop-btn {
    width: 100%;
    padding: 9px 16px;
    border-radius: 10px;
    background: rgba(255, 70, 70, 0.09);
    color: #ff7070;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255, 70, 70, 0.20);
    cursor: pointer;
    transition: background 0.18s, opacity 0.2s;
}

.ebike-stop-btn:hover:not(:disabled) { background: rgba(255,70,70,0.18); }

.ebike-stop-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.dev-info {
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 10px 14px;
}

.dev-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dev-row:last-child { border-bottom: none; }

.dev-key {
    font-size: 10.5px;
    font-family: 'Courier New', monospace;
    color: #5a7f9a;
    flex-shrink: 0;
    width: 55px;
}

.dev-val {
    font-size: 10.5px;
    font-family: 'Courier New', monospace;
    color: #9fc8e8;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 230px;
}

.dev-log-val { opacity: 0.65; font-size: 9.5px !important; }
.dev-error-val { color: #ff7070 !important; }

@media (max-width: 980px) {
    .page { grid-template-columns: 1fr; }
    .grid { grid-template-columns: repeat(2, 1fr); }
}
