/* =========================================================
   Tugella Care — iOS-style design system
   ========================================================= */

:root{
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card-elevated: #FFFFFF;
  --label: #1C1C1E;
  --label-secondary: rgba(60,60,67,0.62);
  --label-tertiary: rgba(60,60,67,0.4);
  --separator: rgba(60,60,67,0.16);
  --blue: #007AFF;
  --blue-2: #0A84FF;
  --green: #34C759;
  --orange: #FF9500;
  --red: #FF3B30;
  --purple: #AF52DE;
  --gray: #8E8E93;
  --fill-blue: rgba(0,122,255,0.12);
  --fill-orange: rgba(255,149,0,0.14);
  --fill-green: rgba(52,199,89,0.14);
  --fill-red: rgba(255,59,48,0.13);
  --fill-purple: rgba(175,82,222,0.13);
  --fill-gray: rgba(142,142,147,0.14);
  --navbar-blur: saturate(180%) blur(20px);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -12px rgba(0,0,0,0.12);
  --accent-gradient: linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 55%, #0A2540 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #000000;
    --card: #1C1C1E;
    --card-elevated: #2C2C2E;
    --label: #F2F2F7;
    --label-secondary: rgba(235,235,245,0.6);
    --label-tertiary: rgba(235,235,245,0.38);
    --separator: rgba(84,84,88,0.6);
    --fill-blue: rgba(10,132,255,0.18);
    --fill-orange: rgba(255,159,10,0.2);
    --fill-green: rgba(48,209,88,0.2);
    --fill-red: rgba(255,69,58,0.2);
    --fill-purple: rgba(191,90,242,0.2);
    --fill-gray: rgba(142,142,147,0.22);
    --accent-gradient: linear-gradient(135deg, #0A0A0C 0%, #17171A 55%, #06182B 100%);
  }
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
input, button, textarea{ font-family: inherit; }

/* fake dynamic-island / status strip just for aesthetic top spacing on desktop preview */
.status-strip{ height: var(--safe-top); }

.app{
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

/* ---------- Screens ---------- */
.screen{
  display:none;
  min-height: 100vh;
  position: relative;
}
.screen.active{ display:block; }

/* ---------- Navbar (large title) ---------- */
.navbar{
  position: sticky;
  top:0;
  z-index: 20;
  padding-top: var(--safe-top);
}
.navbar-blur{
  position:absolute; inset:0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: var(--navbar-blur);
  -webkit-backdrop-filter: var(--navbar-blur);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.navbar-large-title{
  position: relative;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.4px;
  padding: 8px 20px 12px;
}
.navbar-inline-title{ display:none; }

/* ---------- Content ---------- */
.content{
  position: relative;
  padding: 4px 16px 0;
}
.section-label{
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--label-secondary);
  margin: 22px 4px 8px;
}
.hint-text{
  font-size: 13px;
  color: var(--label-tertiary);
  margin: 8px 6px 0;
  line-height: 1.4;
}
.tab-bottom-spacer{ height: 110px; }

/* ---------- Car hero card ---------- */
.car-card{
  position: relative;
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--accent-gradient);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-top: 8px;
}
.car-card-glow{
  position:absolute; width:260px; height:260px; right:-90px; top:-110px;
  background: radial-gradient(circle, rgba(10,132,255,0.55), transparent 70%);
  filter: blur(10px);
}
.car-card-top{ position:relative; display:flex; justify-content:space-between; align-items:flex-start; }
.car-card-eyebrow{ font-size:12px; opacity:.7; font-weight:600; letter-spacing:.3px; text-transform:uppercase; }
.car-card-name{ font-size:22px; font-weight:800; margin-top:4px; letter-spacing:.3px; }
.car-card-badge{
  font-size:12px; font-weight:700; padding:6px 11px; border-radius:20px;
  background: rgba(52,199,89,0.22); color:#5ee08a; border:1px solid rgba(94,224,138,0.35);
}
.car-card-badge.warn{ background: rgba(255,149,0,0.22); color:#ffb84d; border-color: rgba(255,184,77,0.35); }
.car-card-badge.danger{ background: rgba(255,59,48,0.24); color:#ff8078; border-color: rgba(255,128,120,0.35); }
.car-card-stats{ position:relative; display:flex; margin-top:22px; }
.car-card-stat{ flex:1; text-align:center; }
.car-card-stat-value{ font-size:16px; font-weight:800; }
.car-card-stat-label{ font-size:11px; opacity:.65; margin-top:3px; }
.car-card-stat-divider{ width:1px; background: rgba(255,255,255,0.15); margin: 2px 4px; }

/* ---------- Ring card ---------- */
.ring-card{
  display:flex; align-items:center; gap:16px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.ring-wrap{ position:relative; width:100px; height:100px; flex-shrink:0; }
.ring-svg{ width:100%; height:100%; transform: rotate(-90deg); }
.ring-track{ fill:none; stroke: var(--fill-gray); stroke-width:11; }
.ring-progress{
  fill:none; stroke: var(--green); stroke-width:11; stroke-linecap: round;
  stroke-dasharray: 377; stroke-dashoffset: 377;
  transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1), stroke .3s ease;
}
.ring-center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.ring-days{ font-size:22px; font-weight:800; line-height:1; }
.ring-unit{ font-size:11px; color: var(--label-secondary); margin-top:2px; }
.ring-info{ flex:1; min-width:0; }
.ring-info-title{ font-size:15px; font-weight:700; }
.ring-info-sub{ font-size:13px; color: var(--label-secondary); margin-top:2px; margin-bottom:8px; }
.ring-info-row{ display:flex; align-items:center; gap:7px; font-size:12.5px; color: var(--label-secondary); margin-top:4px; }
.dot{ width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.dot-blue{ background: var(--blue); }
.dot-gray{ background: var(--gray); }
.dot-orange{ background: var(--orange); }
.dot-red{ background: var(--red); }
.dot-green{ background: var(--green); }

/* ---------- Grouped list card ---------- */
.list-card{
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.list-row{
  display:flex; align-items:center; gap:12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator);
}
.list-row:last-child{ border-bottom:none; }
.list-row-icon{
  width:30px; height:30px; border-radius:8px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:15px;
}
.icon-blue{ background: var(--fill-blue); }
.icon-orange{ background: var(--fill-orange); }
.icon-green{ background: var(--fill-green); }
.icon-purple{ background: var(--fill-purple); }
.icon-red{ background: var(--fill-red); }
.icon-gray{ background: var(--fill-gray); }
.list-row-body{ flex:1; display:flex; flex-direction:column; gap:3px; }
.list-row-body label{ font-size:12px; color: var(--label-secondary); font-weight:500; }
.list-row-body input{
  border:none; background:transparent; font-size:16px; color:var(--label);
  padding:2px 0; outline:none; font-weight:500;
}
.list-row-body input::placeholder{ color: var(--label-tertiary); font-weight:400; }

/* ---------- Buttons ---------- */
.primary-button{
  width:100%; margin-top:18px;
  background: var(--blue);
  color:#fff; border:none; border-radius: var(--radius-md);
  padding: 15px; font-size:16px; font-weight:700;
  cursor:pointer; transition: transform .12s ease, opacity .12s ease;
}
.primary-button:active{ transform: scale(0.97); opacity:.85; }
.ghost-button{
  background: var(--fill-blue); color: var(--blue);
  border:none; border-radius: 10px; padding:9px 14px;
  font-size:13px; font-weight:700; cursor:pointer; margin-top:10px;
}
.ghost-button:active{ opacity:.7; }

/* ---------- Segmented control ---------- */
.segmented{
  display:flex; background: var(--fill-gray); border-radius: 10px; padding:3px; margin: 10px 0 16px;
}
.segmented-btn{
  flex:1; border:none; background:transparent; padding:7px 4px; font-size:13px; font-weight:600;
  color: var(--label-secondary); border-radius:8px; cursor:pointer; transition: all .15s ease;
}
.segmented-btn.active{ background: var(--card); color: var(--label); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ---------- Service item cards ---------- */
.service-item{
  background: var(--card); border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-card);
  display:flex; gap:12px; align-items:flex-start;
  cursor:pointer;
}
.service-item-icon{
  width:38px; height:38px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:18px;
}
.service-item-body{ flex:1; min-width:0; }
.service-item-title{ font-size:15px; font-weight:700; }
.service-item-meta{ font-size:12.5px; color: var(--label-secondary); margin-top:2px; }
.service-item-progress{ margin-top:10px; }
.progress-track{
  height:6px; background: var(--fill-gray); border-radius:4px; overflow:hidden;
}
.progress-fill{ height:100%; background: var(--green); border-radius:4px; width:0%; transition: width .5s ease, background .3s ease; }
.service-item-footer{ display:flex; justify-content:space-between; margin-top:7px; font-size:11.5px; color: var(--label-tertiary); }
.service-item-status{
  font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px; white-space:nowrap; flex-shrink:0;
}
.status-ok{ background: var(--fill-green); color: var(--green); }
.status-soon{ background: var(--fill-orange); color: var(--orange); }
.status-due{ background: var(--fill-red); color: var(--red); }

/* ---------- Info card ---------- */
.info-card{
  background: var(--card); border-radius: var(--radius-md);
  padding:16px; margin-top:18px; box-shadow: var(--shadow-card);
}
.info-card-title{ font-size:14px; font-weight:700; margin-bottom:6px; }
.info-card p{ font-size:13px; color: var(--label-secondary); line-height:1.5; margin:0; }
.warn-card{ border: 1px solid var(--fill-orange); background: color-mix(in srgb, var(--fill-orange) 40%, var(--card)); margin-top:8px;}

/* ---------- Checklist ---------- */
.checklist-progress-card{
  background: var(--card); border-radius: var(--radius-lg); padding:16px; margin-top:8px; box-shadow: var(--shadow-card);
}
.checklist-progress-text{ font-size:14px; font-weight:600; margin-bottom:8px; }
.checklist-group-title{
  font-size:13px; font-weight:700; letter-spacing:.2px;
  color: var(--label); margin: 20px 2px 8px; display:flex; align-items:center; gap:8px;
  padding-left:10px; border-left:3px solid var(--group-color, var(--blue));
}
.checklist-group-title .group-icon{ font-size:14px; }
.checklist-group-title .group-title-text{ flex:1; text-transform:uppercase; font-size:12px; letter-spacing:.3px; color: var(--label-secondary); }
.checklist-group-title .group-count{
  font-size:11px; font-weight:800; padding:2px 8px; border-radius:20px;
  background: color-mix(in srgb, var(--group-color, var(--blue)) 16%, transparent);
  color: var(--group-color, var(--blue));
}
.checklist-card{
  background: var(--card); border-radius: var(--radius-md); overflow:hidden; box-shadow: var(--shadow-card);
  border-left: 3px solid color-mix(in srgb, var(--group-color, var(--blue)) 55%, transparent);
}
.check-row{
  display:flex; align-items:center; gap:12px; padding:12px 14px; border-bottom:1px solid var(--separator); cursor:pointer;
}
.check-row:last-child{ border-bottom:none; }
.check-box{
  width:24px; height:24px; border-radius:50%; border:2px solid var(--separator); flex-shrink:0;
  display:flex; align-items:center; justify-content:center; transition: all .15s ease;
}
.check-row.checked .check-box{ background: var(--group-color, var(--green)); border-color: var(--group-color, var(--green)); }
.check-box svg{ width:13px; height:13px; opacity:0; transform: scale(0.5); transition: all .15s ease; stroke: white; }
.check-row.checked .check-box svg{ opacity:1; transform: scale(1); }
.check-label{ flex:1; font-size:14.5px; font-weight:500; }
.check-row.checked .check-label{ color: var(--label-tertiary); text-decoration: line-through; }

/* ---------- Car scheme ---------- */
.scheme-card{
  background: var(--card); border-radius: var(--radius-lg); padding:18px 14px 14px;
  box-shadow: var(--shadow-card); position:relative; margin-top:10px;
}
.scheme-svg{ width:100%; height:auto; display:block; max-width:340px; margin:0 auto; }
.hotspot{ cursor:pointer; }
.hotspot circle.pulse{ fill: rgba(0,122,255,0.28); }
.hotspot circle.dot-core{ fill: var(--blue); stroke:#fff; stroke-width:2.5; transition: r .15s ease, fill .15s ease; }
.hotspot circle.dot-hit{ fill: transparent; }
.hotspot:hover circle.dot-core, .hotspot:focus circle.dot-core{ fill: var(--blue-2); }
.hotspot:focus{ outline:none; }
.scheme-legend{
  display:flex; align-items:center; justify-content:center; gap:6px;
  margin-top:6px; font-size:11.5px; color: var(--label-tertiary); font-weight:500;
}
.scheme-legend .dot{ width:8px; height:8px; }

/* ---------- Places / map ---------- */
.map-card{
  background: var(--card); border-radius: var(--radius-lg); overflow:hidden;
  box-shadow: var(--shadow-card); margin-top:10px; position:relative;
}
.map-card-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px; border-bottom:1px solid var(--separator);
}
.map-card-title{ font-size:14px; font-weight:700; display:flex; align-items:center; gap:7px; }
.map-card-title .dot{ width:8px; height:8px; }
.map-card-open{
  font-size:12px; font-weight:700; color: var(--blue); text-decoration:none;
  background: var(--fill-blue); padding:5px 10px; border-radius:20px;
}
.map-frame-wrap{ position:relative; width:100%; height:260px; background: var(--fill-gray); }
.map-frame-wrap iframe{ width:100%; height:100%; border:0; display:block; }
.map-frame-loading{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:12.5px; color: var(--label-tertiary); pointer-events:none;
}

.place-card{
  background: var(--card); border-radius: var(--radius-md); padding:14px; margin-bottom:10px; box-shadow: var(--shadow-card);
  transition: box-shadow .15s ease;
}
.place-card.active-place{ box-shadow: 0 0 0 2px var(--blue), var(--shadow-card); }
.place-name{ font-size:15px; font-weight:700; }
.place-tag{ display:inline-block; font-size:10.5px; font-weight:700; color: var(--blue); background: var(--fill-blue); padding:2px 8px; border-radius:20px; margin-top:6px; }
.place-addr{ font-size:13px; color: var(--label-secondary); margin-top:8px; line-height:1.45; }
.place-actions{ display:flex; gap:8px; margin-top:12px; }
.place-btn{
  flex:1; text-align:center; text-decoration:none; font-size:12.5px; font-weight:700;
  padding:9px 6px; border-radius:9px; background: var(--fill-blue); color: var(--blue);
}
.place-btn.secondary{ background: var(--fill-gray); color: var(--label); }

/* ---------- Tab bar ---------- */
.tabbar{
  position: fixed; left:50%; transform: translateX(-50%);
  bottom:0; width:100%; max-width:480px; z-index: 30;
  display:flex; padding-bottom: var(--safe-bottom);
}
.tabbar-blur{
  position:absolute; inset:0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: var(--navbar-blur); -webkit-backdrop-filter: var(--navbar-blur);
  border-top: 1px solid var(--separator);
}
.tabbar-item{
  position: relative; flex:1; background:none; border:none; padding:8px 2px 6px;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color: var(--gray); cursor:pointer;
}
.tabbar-item span{ font-size:10px; font-weight:600; }
.tab-icon{ width:25px; height:25px; fill:none; stroke: var(--gray); stroke-width:1.7; }
.tabbar-item.active{ color: var(--blue); }
.tabbar-item.active .tab-icon{ stroke: var(--blue); }

/* ---------- Bottom sheet ---------- */
.sheet-overlay{
  position: fixed; inset:0; background: rgba(0,0,0,0.4);
  opacity:0; pointer-events:none; transition: opacity .25s ease; z-index: 50;
  display:flex; align-items:flex-end; justify-content:center;
}
.sheet-overlay.open{ opacity:1; pointer-events:auto; }
.sheet{
  width:100%; max-width:480px; background: var(--card);
  border-radius: 20px 20px 0 0; padding: 10px 20px calc(24px + var(--safe-bottom));
  max-height: 82vh; overflow-y:auto;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
}
.sheet-overlay.open .sheet{ transform: translateY(0); }
.sheet-grabber{ width:36px; height:5px; background: var(--separator); border-radius:3px; margin: 6px auto 14px; }
.sheet-content h3{ font-size:19px; font-weight:800; margin:0 0 4px; }
.sheet-content .sheet-sub{ font-size:13px; color: var(--label-secondary); margin-bottom:14px; }
.sheet-content .sheet-block{ margin-bottom:14px; }
.sheet-content .sheet-block-title{ font-size:12px; font-weight:700; text-transform:uppercase; color: var(--label-secondary); margin-bottom:6px; letter-spacing:.3px; }
.sheet-content p{ font-size:14px; line-height:1.55; margin:0 0 8px; color: var(--label); }
.sheet-link{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 14px; background: var(--fill-blue); border-radius:10px; margin-bottom:8px;
  text-decoration:none; color: var(--blue); font-size:13.5px; font-weight:600;
}
.sheet-link span.arrow{ font-size:16px; }
.sheet-close{
  width:100%; padding:13px; border:none; border-radius:12px; background: var(--fill-gray);
  color: var(--label); font-size:15px; font-weight:700; margin-top:6px; cursor:pointer;
}

/* ---------- Toast ---------- */
.toast{
  position: fixed; left:50%; bottom:110px; transform: translate(-50%, 20px);
  background: rgba(28,28,30,0.92); color:#fff; padding:11px 20px; border-radius:14px;
  font-size:13.5px; font-weight:600; opacity:0; pointer-events:none; transition: all .3s ease; z-index:60;
  backdrop-filter: blur(10px);
}
.toast.show{ opacity:1; transform: translate(-50%, 0); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar{ width:0; height:0; }

/* ---------- Responsive niceties ---------- */
@media (min-width: 481px){
  body{ background: #E5E5EA; }
  .app{ box-shadow: 0 0 60px rgba(0,0,0,0.15); min-height: 100vh; }
}
