@charset "UTF-8";

/* View Transitions - smooth cross-fade on navigation (Chrome 126+) */
@view-transition { navigation: auto; }

@keyframes vt-fade-in  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes vt-fade-out { from { opacity: 1; } to { opacity: 0; } }

::view-transition-new(root) { animation: vt-fade-in  0.18s ease; }
::view-transition-old(root) { animation: vt-fade-out 0.12s ease; }

/* ===========================================
   Design System - Variables
   =========================================== */

:root {
  --bg:        #F2F2F7;
  --surface:   #FFFFFF;
  --label:     #000000;
  --label2:    rgba(60,60,67,0.6);
  --label3:    rgba(60,60,67,0.3);
  --separator: rgba(60,60,67,0.2);
  --fill:      rgba(120,120,128,0.12);
  --fill2:     rgba(120,120,128,0.20);
  --red:       #FF3B30;
  --green:     #34C759;
  --brand:     #1C3D5A;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,0.1), 0 1px 0 rgba(0,0,0,0.06);
}

/* ===========================================
   Reset & Base
   =========================================== */

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

html, body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background-color: #F2F2F7;
  color: #000000;
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===========================================
   Navigation Bar (Actionbar)
   =========================================== */

nav ul, .actionbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.actionbar {
  background: rgba(28, 61, 90, 0.96);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  width: 100vw;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 200;
}

.actionbar a {
  color: #ffffff;
  background: rgba(255,255,255,0.15);
  padding: 7px 15px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.actionbar a:hover  { background: rgba(255,255,255,0.25); }
.actionbar a:active { background: rgba(255,255,255,0.35); }
.actionbar a.active { background: rgba(255,255,255,0.35); }

/* ===========================================
   Card
   =========================================== */

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  width: calc(100% - 32px);
  max-width: 390px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 0 rgba(0,0,0,0.06);
  box-sizing: border-box;
}

/* ===========================================
   Typography
   =========================================== */

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #000000;
  padding: 20px 16px 8px;
  margin: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(60,60,67,0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #000000;
  line-height: 1;
}

.unit {
  font-size: 20px;
  font-weight: 300;
  color: rgba(60,60,67,0.6);
}

.subtext {
  font-size: 13px;
  color: rgba(60,60,67,0.6);
  margin-top: 4px;
}

.error {
  font-size: 13px;
  color: #FF3B30;
  margin-top: 6px;
}

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

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: #1C3D5A;
  color: #ffffff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

button:hover, .btn:hover   { opacity: 0.85; }
button:active, .btn:active { opacity: 0.7; transform: scale(0.98); }
.btn-block { width: 100%; margin-top: 16px; }

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

label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(60,60,67,0.6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 6px;
}

input[type=text],
input[type=number],
input[type=password],
input[type=datetime-local],
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: none;
  background: rgba(120,120,128,0.12);
  font-family: inherit;
  font-size: 17px;
  color: #000000;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  transition: background 0.15s;
}

input:focus, textarea:focus {
  background: rgba(120,120,128,0.20);
}

/* -- Tables -- */
table { border-collapse: collapse; width: 100%; }

th {
  background: #F2F2F7;
  color: rgba(60,60,67,0.6);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(60,60,67,0.2);
  text-align: center;
}

td {
  padding: 12px;
  border-bottom: 1px solid rgba(60,60,67,0.12);
  font-size: 15px;
  text-align: center;
}

tr:last-child td { border-bottom: none; }

/* ===========================================
   Dashboard (index.php)
   =========================================== */

body.page-dashboard {
  background-color: #F2F2F7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 40px;
}

body.page-dashboard .card { max-width: 390px; }

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

.header span {
  font-size: 15px;
  font-weight: 500;
  color: rgba(60,60,67,0.6);
}

.pulse { font-size: 15px; color: rgba(60,60,67,0.6); font-weight: 500; }

.status-line {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.status-bar  { height: 6px; border-radius: 3px; flex-grow: 1; margin-right: 12px; }
.status-label { font-size: 15px; font-weight: 600; color: #000000; }

.legend       { display: none; font-size: 13px; margin-top: 12px; color: rgba(60,60,67,0.6); }
.legend-item  { display: flex; align-items: center; margin-top: 6px; }
.legend-color { width: 14px; height: 6px; border-radius: 3px; margin-right: 8px; flex-shrink: 0; }

.weight-container { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.weight-left      { flex: 1; }
.graph            { flex: 1; height: 60px; }
svg               { width: 100%; height: 100%; }
.weight-line      { fill: none; stroke: #000000; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.change-positive  { color: #FF3B30; font-size: 13px; }
.change-negative  { color: #34C759; font-size: 13px; }

/* ===========================================
   Shared log / graph pages
   =========================================== */

body.page-log,
body.page-graph,
body.page-notes { padding-bottom: 40px; }

/* ===========================================
   Blood Pressure Input
   =========================================== */

.bp-input-form form,
.bp-input-form .confirm-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  max-width: 390px;
  margin: 16px auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bp-input-form table { margin-bottom: 12px; }
.bp-input-form th { background: transparent; padding: 8px 6px; border-bottom: 1px solid rgba(60,60,67,0.2); text-transform: none; font-size: 14px; font-weight: 600; }
.bp-input-form td { border: none; padding: 8px 4px; }
.bp-input-form input[type=number] { width: 68px; padding: 8px; text-align: center; font-size: 20px; font-weight: 600; }
.bp-input-form button { width: 100%; margin-top: 16px; }

/* ===========================================
   Blood Pressure Log
   =========================================== */

.bp-log-table {
  width: calc(100% - 32px);
  max-width: 900px;
  margin: 0 auto 24px;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bp-log-table .value { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; color: #000000; }
.bp-log-table .unit  { font-size: 11px; color: rgba(60,60,67,0.6); font-weight: 400; margin-top: 2px; display: block; }
.tidkom              { text-align: left; font-size: 15px; line-height: 1.4; }
.tidkom small        { color: rgba(60,60,67,0.6); font-size: 13px; }
.colorbar            { width: 4px; padding: 0; }

/* ===========================================
   Blood Pressure Graph
   =========================================== */

.actionbar2 {
  background: rgba(51,153,255,0.92);
  padding: 10px 16px;
  display: flex;
  gap: 8px;
}

.filter-buttons { display: flex; justify-content: center; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.filter-buttons button { padding: 8px 18px; font-size: 15px; border-radius: 20px; background: rgba(120,120,128,0.12); color: #1C3D5A; font-weight: 600; }

.chart-wrap {
  width: calc(100% - 32px);
  max-width: 960px;
  height: 460px;
  margin: 0 auto 24px;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===========================================
   Weight Input
   =========================================== */

.weight-input-form form,
.weight-input-form .confirm-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  max-width: 390px;
  margin: 16px auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.measurement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(60,60,67,0.12);
}

.measurement:last-of-type { border-bottom: none; }

.measurement label {
  font-size: 17px;
  font-weight: 400;
  color: #000000;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  flex: 1;
}

.measurement input {
  width: 110px;
  text-align: right;
  font-size: 17px;
  background: transparent;
  padding: 0;
}

.measurement input:focus { background: transparent; }
.weight-input-form button { width: 100%; margin-top: 20px; }

.confirm-box p        { padding: 12px 0; border-bottom: 1px solid rgba(60,60,67,0.12); font-size: 17px; }
.confirm-box p:last-of-type { border-bottom: none; }
.confirm-box strong   { color: rgba(60,60,67,0.6); font-weight: 500; }

/* ===========================================
   Weight Graph
   =========================================== */

body.page-weight-graph { background-color: #F2F2F7; }

.overlay {
  background-color: rgba(242,242,247,0.90);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  min-height: 100vh;
  padding-bottom: 40px;
}

.chart-container { width: calc(100% - 32px); max-width: 900px; margin: 0 auto; height: calc(100vh - 180px); background: #ffffff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ===========================================
   Weight Log
   =========================================== */

.weight-log-table {
  width: calc(100% - 32px);
  max-width: 900px;
  margin: 0 auto 24px;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.weight-log-table .value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; color: #000000; }
.weight-log-table .unit  { font-size: 11px; color: rgba(60,60,67,0.6); font-weight: 400; margin-top: 2px; display: block; }

/* ===========================================
   Notes
   =========================================== */

main { padding: 16px; max-width: 600px; margin: 0 auto; }

form.new-note { background: #ffffff; padding: 14px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 16px; }

a.note-card {
  display: flex;
  align-items: stretch;
  background: #ffffff;
  margin-bottom: 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

a.note-card:hover { opacity: 0.8; }

.date-section {
  background: #1C3D5A;
  color: #ffffff;
  width: 62px;
  flex-shrink: 0;
  text-align: center;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.date-section .day   { font-size: 24px; font-weight: 700; line-height: 1; }
.date-section .month { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; opacity: 0.8; }
.date-section .time  { font-size: 11px; font-weight: 400; margin-top: 4px; opacity: 0.65; }

.note-content { flex: 1; padding: 12px 16px; display: flex; align-items: center; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }

/* ===========================================
   Notes Edit
   =========================================== */

.notes-edit-page     { max-width: 700px; margin: 0 auto; padding: 16px; }
.notes-edit-page textarea { height: 400px; resize: none; line-height: 1.5; }
.cancel-btn          { background: rgba(120,120,128,0.2); color: #000000; margin-left: 8px; }
.cancel-btn:hover    { opacity: 0.7; }
.msg                 { color: #FF3B30; margin-top: 10px; font-size: 15px; }

/* ===========================================
   Login
   =========================================== */

body.page-login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-wrapper { width: 100%; max-width: 360px; }

.card h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.4px;
  text-align: center;
  margin: 0 0 20px;
}

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

/* ===========================================
   Push-ups
   =========================================== */

body.page-pushups {
  background-color: #F2F2F7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 48px;
}

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.stat-item  { background: rgba(120,120,128,0.12); border-radius: 8px; padding: 12px; text-align: center; }
.stat-label { font-size: 11px; color: rgba(60,60,67,0.6); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -1px; color: #000000; line-height: 1; }

.form-row               { display: flex; gap: 12px; align-items: flex-end; }
.form-row .form-field   { flex: 1; }

/* iOS Segmented Control */
.tabs     { display: flex; background: rgba(120,120,128,0.12); border-radius: 9px; padding: 2px; margin-bottom: 16px; gap: 2px; }
.tab      { flex: 1; text-align: center; padding: 7px 10px; font-size: 13px; font-weight: 600; color: rgba(60,60,67,0.6); cursor: pointer; border-radius: 7px; transition: all 0.2s; user-select: none; -webkit-tap-highlight-color: transparent; }
.tab.active { background: #ffffff; color: #000000; box-shadow: 0 1px 4px rgba(0,0,0,0.14); }

.panel        { display: none; }
.panel.active { display: block; }

.day-group  { margin-bottom: 4px; }
.day-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 8px; border-bottom: 1px solid rgba(60,60,67,0.12); cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.day-label  { font-weight: 600; color: #000000; font-size: 15px; }
.day-total  { font-size: 13px; color: rgba(60,60,67,0.6); }

.session-row  { display: flex; align-items: center; padding: 10px 0 10px 10px; border-bottom: 1px solid rgba(60,60,67,0.08); gap: 12px; }
.session-time { color: rgba(60,60,67,0.6); font-size: 15px; min-width: 44px; font-variant-numeric: tabular-nums; }
.session-reps { flex: 1; font-weight: 500; color: #000000; font-size: 17px; }

.btn-del       { background: none; border: none; color: rgba(60,60,67,0.3); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: color 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent; }
.btn-del:hover { color: #FF3B30; background: rgba(255,59,48,0.1); }

.period-group   { margin-bottom: 8px; }
.period-header  { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: #ffffff; border-radius: 8px; margin-bottom: 2px; cursor: pointer; user-select: none; box-shadow: 0 1px 3px rgba(0,0,0,0.08); -webkit-tap-highlight-color: transparent; }
.period-name    { font-weight: 600; color: #000000; font-size: 15px; }
.period-meta    { font-size: 13px; color: rgba(60,60,67,0.6); margin-top: 2px; }
.period-total   { font-size: 15px; color: rgba(60,60,67,0.6); font-weight: 500; }
.period-body    { display: none; padding: 0 6px; }

.flash          { background: rgba(52,199,89,0.15); color: #1c7a38; font-weight: 600; font-size: 15px; border-radius: 8px; padding: 12px 16px; animation: fadeout 3s forwards; }
.flash.del      { background: rgba(255,149,0,0.15); color: #a05000; }

@keyframes fadeout { 0%,70% { opacity: 1; } 100% { opacity: 0; } }

.empty { text-align: center; padding: 40px 20px; color: rgba(60,60,67,0.6); font-size: 15px; }

/* ===========================================
   Workout (gåture / GPX-ruter)
   =========================================== */

body.page-workout { background-color: #F2F2F7; padding-bottom: 40px; }

.container { max-width: 900px; margin: 0 auto; padding: 15px; }

.card-link { text-decoration: none; color: inherit; }

.workout-card {
  display: grid;
  grid-template-columns: 80px 1fr 110px;
  background: #ffffff;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.datebox { background: #1C3D5A; color: #ffffff; padding: 12px; text-align: center; }
.datebox .d { font-size: 26px; font-weight: bold; }
.datebox .m { font-size: 14px; margin-top: -4px; }
.datebox .t { font-size: 13px; margin-top: 4px; opacity: 0.9; }

.workout-card .info { padding: 15px; display: flex; flex-direction: column; justify-content: center; }
.workout-card .info .dist { font-size: 22px; font-weight: bold; }
.workout-card .info .dur  { font-size: 15px; margin-top: 4px; color: rgba(60,60,67,0.6); }

.workout-card .map { width: 110px; height: 100%; }

/* -- Upload GPX -- */
.msg { margin-bottom: 15px; padding: 12px; border-radius: 8px; background: rgba(52,199,89,0.15); color: #1c7a38; font-weight: 600; }
.msg.error { background: rgba(255,59,48,0.12); color: #b71c1c; }

/* -- Rutevisning (show-route.php) -- */
.workout-route { padding: 16px; max-width: 900px; margin: 0 auto; }

.workout-route .info {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 16px 20px;
  margin-bottom: 16px;
  text-align: center;
}

.workout-route .date     { font-size: 1.2em; font-weight: bold; color: #1C3D5A; }
.workout-route .time     { font-size: 0.9em; color: rgba(60,60,67,0.6); }
.workout-route .distance { font-size: 1.8em; font-weight: bold; color: #1C3D5A; margin-top: 10px; }
.workout-route .duration { font-size: 1em; color: rgba(60,60,67,0.6); }

.btn-del-route {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255,59,48,0.1);
  color: #FF3B30;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.btn-del-route:hover { background: rgba(255,59,48,0.18); }

#map {
  width: 100%;
  height: 500px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
  .workout-route { padding: 10px; }
  #map { height: 400px; }
}
