﻿/* ============================================================
 * D-SYA — Balon Pintasan & Quick Control Panel CSS
 * Persistent Floating Shortcut Bubble & Background Operation Widget
 * Peran: Pelanggan | Driver | Merchant
 * Tema: ☁️ Bright Sky Blue — Biru Langit Cerah
 * ============================================================ */

:root {
  --ds-bubble-green: #0284c7;
  --ds-bubble-green-light: #38bdf8;
  --ds-bubble-gold: #0ea5e9;
  --ds-bubble-danger: #dc2626;
  --ds-bubble-warning: #d97706;
  --ds-bubble-surface: #ffffff;
  --ds-bubble-text: #0f172a;
  --ds-bubble-muted: #475569;
  --ds-bubble-border: #7dd3fc;
}

/* Floating Container Wrapper */
#ds-floating-bubble-container {
  position: fixed;
  bottom: 85px;
  right: 18px;
  z-index: 999999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  direction: ltr;
}

/* The Draggable Floating Bubble */
#ds-floating-bubble {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  box-shadow: 0 8px 28px rgba(2, 132, 199, 0.45), 0 0 0 3px rgba(255, 255, 255, 0.9);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
  backdrop-filter: blur(8px);
}

#ds-floating-bubble:active {
  cursor: grabbing;
  transform: scale(0.92);
}

#ds-floating-bubble:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.6), 0 0 0 4px rgba(255, 255, 255, 1);
}

/* Pulsing Radar Ring */
.ds-bubble-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid #0284c7;
  background: rgba(2, 132, 199, 0.15);
  animation: dsBubblePulse 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes dsBubblePulse {
  0% { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* Status Indicator Dot */
.ds-bubble-status-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  background: #94a3b8;
  transition: background 0.3s;
}

.ds-bubble-status-dot.online {
  background: #0284c7;
  box-shadow: 0 0 8px #0284c7;
}

.ds-bubble-status-dot.bg-active {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: dsDotBlink 1.2s infinite alternate;
}

@keyframes dsDotBlink {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

/* Badge Counter */
.ds-bubble-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 100px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.5);
  display: none;
}

.ds-bubble-badge.show {
  display: inline-block;
  animation: dsBadgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dsBadgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Expanded Quick Control Panel Overlay */
#ds-quick-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 330px;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid var(--ds-bubble-border);
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(2, 132, 199, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(16px);
  padding: 1.25rem;
  display: none;
  flex-direction: column;
  gap: 0.875rem;
  animation: dsPanelSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
  color: var(--ds-bubble-text);
  z-index: 1000000;
}

#ds-quick-panel.open {
  display: flex;
}

@keyframes dsPanelSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel Header */
.ds-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #e0f2fe;
  padding-bottom: 0.75rem;
  gap: 0.5rem;
}

.ds-panel-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  flex: 1;
  flex-wrap: wrap;
}

.ds-vehicle-bubble-icon {
  width: 1.55rem;
  height: 1.55rem;
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 3px rgba(3, 105, 161, 0.25));
}
.ds-role-pill .ds-vehicle-bubble-icon { width: 1.15rem; height: 1.15rem; }
#ds-bubble-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; line-height: 0; overflow: hidden; }
#ds-bubble-icon .ds-vehicle-bubble-icon { width: 34px !important; height: 34px !important; max-width: 34px; max-height: 34px; display: block; object-fit: contain; }

/* ── Role Pill Badge ── */
.ds-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  margin-left: auto;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Pelanggan — Sky Blue */
.ds-role-pill.ds-role-pelanggan {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

/* Driver — Sky Blue teal */
.ds-role-pill.ds-role-driver {
  background: #bae6fd;
  color: #0284c7;
  border: 1px solid #38bdf8;
}

/* Merchant — Sky Blue */
.ds-role-pill.ds-role-merchant {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.ds-panel-close {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ds-panel-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Status Banner */
.ds-bg-status-card {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border: 1.5px solid #7dd3fc;
  border-radius: 16px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ds-bg-status-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2,132,199,0.15);
  flex-shrink: 0;
}

.ds-bg-status-text { flex: 1; }

.ds-bg-status-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0284c7;
}

.ds-bg-status-sub {
  font-size: 0.7rem;
  color: #475569;
  margin-top: 0.1rem;
}

/* Quick Control Toggles */
.ds-quick-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ds-toggle-row-highlight {
  background: rgba(2, 132, 199, 0.06);
  border-color: rgba(2, 132, 199, 0.24);
}
.ds-toggle-row-highlight i { color: #0284c7; margin-right: 0.25rem; }
.ds-toggle-row i { width: 1rem; text-align: center; }

.ds-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.ds-toggle-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #334155;
  cursor: pointer;
}

/* Switch UI */
.ds-switch {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-block;
}

.ds-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ds-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 100px;
  transition: background 0.2s;
  cursor: pointer;
}

.ds-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.ds-switch input:checked + .ds-slider {
  background: #0284c7;
}

.ds-switch input:checked + .ds-slider::before {
  transform: translateX(18px);
}

/* Active Order Card in Panel */
.ds-panel-active-order {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 16px;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ds-order-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 800;
  color: #0284c7;
}

.ds-order-panel-body {
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.4;
}

.ds-order-panel-btns {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.ds-panel-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: none;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.ds-btn-primary {
  background: #0284c7;
  color: #ffffff;
}
.ds-btn-primary:hover { background: #0369a1; }

.ds-btn-secondary {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #7dd3fc;
}
.ds-btn-secondary:hover { background: #bae6fd; }

/* Grid Navigation Shortcuts — 4 columns × 2 rows = 8 items */
.ds-panel-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.ds-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.2rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #334155;
  font-size: 0.62rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  min-height: 56px;
}

.ds-nav-item:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
  transform: translateY(-2px);
}

.ds-nav-item i {
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
  line-height: 1;
}

/* Danger nav item (SOS, Logout) */
.ds-nav-danger {
  color: #dc2626 !important;
  background: #fff1f2 !important;
  border-color: #fca5a5 !important;
}
.ds-nav-danger:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  color: #b91c1c !important;
  transform: translateY(-2px);
}

/* Role Badge in Panel Header */
.ds-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 100px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 8px;
  margin-left: 0.3rem;
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #7dd3fc;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  #ds-floating-bubble-container {
    bottom: 78px;
    right: 12px;
  }
  #ds-quick-panel {
    width: 290px;
    right: -10px;
  }
}
