﻿/* ═══════════════════════════════════════════
   CoachZone — app.css
   Material Design 3  ·  Dark Theme
   Primary: #005DE1  |  Accent: #32CD32
   BG: #121212  |  Text: #FFFFFF
   ═══════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ──────────────────────────────────────────
   COLOR TOKENS  –  Dark Scheme
   Primary: #005DE1  |  Accent: #32CD32
   ────────────────────────────────────────── */
:root {
  /* Primary — niebieski brandowy #005DE1 */
  --primary:               #005DE1;   /* brand blue — przyciski główne */
  --on-primary:            #FFFFFF;   /* tekst na primary */
  --primary-container:     #003494;   /* ciemniejszy niebieski — tła aktywne */
  --on-primary-container:  #C2D9FF;   /* jasny niebieski — tekst na container */

  /* Tertiary — zielony akcent #32CD32 (aktywny/obecny/CTA) */
  --tertiary:               #32CD32;
  --on-tertiary:            #003D00;
  --tertiary-container:     #1A5C1A;  /* ciemna zieleń — tła obecności */
  --on-tertiary-container:  #B7FFB7;  /* jasna zieleń — tekst */

  /* Error — czerwony (nieobecny / błąd) */
  --error:              #FF4444;
  --on-error:           #690005;
  --error-container:    #5C0000;
  --on-error-container: #FFCDD2;

  /* Surfaces — neutralne ciemne, bez zabarwienia */
  --surf-lowest:   #0A0A0A;
  --surf-low:      #0F0F0F;
  --surf:          #1E1E1E;   /* topbar, nav bar */
  --surf-high:     #252525;   /* karty */
  --surf-highest:  #0D0D0D;   /* tło modali — prawie czarne */

  /* Outline */
  --outline:         #404040;
  --outline-variant: #2A2A2A;

  /* Aliasy kompatybilności */
  --bg:      #121212;
  --surface: #1E1E1E;
  --s2:      #252525;
  --border:  #2A2A2A;
  --text:    #FFFFFF;
  --muted:   #B0B0B0;
  --green:   #32CD32;
  --red:     #FF4444;
  --blue:    #005DE1;

  /* MD3 Shape scale */
  --shape-xs:   4px;
  --shape-sm:   8px;
  --shape-md:   12px;
  --shape-lg:   16px;
  --shape-xl:   28px;
  --shape-full: 9999px;

  --font: 'Roboto', sans-serif;
  --mono: 'Roboto Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

input, select, textarea, button {
  font-family: var(--font);
  font-size: 14px;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
.screen.on { display: flex; }

#screen-login {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: var(--bg);
}

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

.login-logo {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.login-logo span { color: var(--primary); }

.login-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
  letter-spacing: 0.25px;
}

.tabs {
  display: flex;
  background: var(--surf-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-full);
  padding: 3px;
  margin-bottom: 24px;
  gap: 3px;
}

.tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: var(--shape-full);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  color: var(--muted);
  border: none;
  background: none;
  transition: all .2s;
}
.tab.on {
  background: var(--primary-container);
  color: #FFFFFF;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.4px;
  opacity: 0.72;
}

input[type=number] {
  -moz-appearance: textfield;
  text-align: center;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

input[type=text],
input[type=password],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  background: #1F1F1F;
  border: 1px solid var(--outline);
  border-radius: var(--shape-lg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, border-width .15s;
  caret-color: var(--primary);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  border-width: 2px;
  padding: 13px 15px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

textarea {
  resize: none;
  min-height: 80px;
  border-radius: var(--shape-lg);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%23B0B0B0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}
select option { background: var(--surf-highest); color: var(--text); }

.err {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  display: none;
  letter-spacing: 0.25px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-form .field { margin-bottom: 0; }
.inline-form .btn {
  flex-shrink: 0;
  align-self: flex-end;
  height: 45px;
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  height: 40px;
  border: none;
  border-radius: var(--shape-full);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  transition: filter .15s, background .15s, box-shadow .15s;
  width: 100%;
  white-space: nowrap;
}

.btn-g { background: var(--primary); color: var(--on-primary); }
.btn-g:hover  { box-shadow: 0 1px 6px rgba(0,0,0,.5); filter: brightness(1.06); }
.btn-g:active { filter: brightness(.9); box-shadow: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--on-primary-container);
}
.btn-ghost:hover  { background: rgba(0,93,225,.12); }
.btn-ghost:active { background: rgba(0,93,225,.20); }

.btn-r {
  background: var(--error-container);
  color: #FFCDD2;
  border: none;
}
.btn-r:hover  { filter: brightness(1.2); }
.btn-r:active { filter: brightness(.85); }

.btn-sm {
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  border-radius: var(--shape-full);
  width: auto;
}

/* Icon-only button — okrągły, 40px */
.btn-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: var(--shape-full);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  background: transparent;
  color: var(--text);
}
.btn-icon .material-symbols-outlined { font-size: 20px; }
.btn-icon:hover  { background: rgba(255,255,255,.10); }
.btn-icon:active { background: rgba(255,255,255,.18); }
.btn-icon.btn-r  { color: var(--error); }
.btn-icon.btn-r:hover  { background: rgba(255,68,68,.16); }
.btn-icon.btn-g  { color: var(--on-primary-container); }
.btn-icon.btn-g:hover  { background: rgba(0,93,225,.14); }

.btn:disabled { opacity: .38; cursor: not-allowed; }

#screen-app { background: var(--bg); }

.topbar {
  background: var(--surf);
  border-bottom: 1px solid var(--outline);
  padding: 0 16px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-logo {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.3px;
}
.topbar-logo span { color: var(--on-primary-container); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu { position: relative; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--shape-full);
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  cursor: pointer;
  user-select: none;
  transition: filter .15s;
}
.user-avatar:hover { filter: brightness(1.18); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surf-highest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-lg);
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,.65);
  z-index: 200;
  overflow: hidden;
  padding: 8px 0;
}
.user-dropdown.open { display: block; }

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
  letter-spacing: 0.15px;
}
.user-dropdown-item:hover { background: rgba(255,255,255,.07); }
.user-dropdown-item--danger { color: var(--error); }
.user-dropdown-item--danger:hover { background: rgba(255,137,125,.10); }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--shape-full);
  background: var(--muted);
  transition: background .3s;
}
.sync-dot.syncing { background: var(--blue);    animation: pulse 1s infinite; }
.sync-dot.synced  { background: var(--tertiary); }
.sync-dot.error   { background: var(--red);      }
.sync-dot.offline { background: var(--muted);    }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.bnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surf);
  border-top: 1px solid var(--outline);
  display: none;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
/* Pasek dolny widoczny tylko gdy aplikacja jest aktywna */
body:has(#screen-app.on) .bnav { display: flex; }

.nitem {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 16px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  transition: color .15s;
  position: relative;
}

.nitem svg {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 1;
  transition: color .15s;
}

/* ── Material Symbols ── */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 24px;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: color .15s;
  user-select: none;
}

.nitem::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 32px;
  border-radius: var(--shape-full);
  background: transparent;
  transition: background .2s;
}
.nitem.on::before { background: var(--primary-container); }
.nitem.on         { color: #FFFFFF; }
.nitem.on .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

.content {
  flex: 1;
  padding: 20px 16px 96px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.page    { display: none; }
.page.on { display: block; }

.page-title {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-lg);
  padding: 16px;
  margin-bottom: 8px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.15px;
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
  letter-spacing: 0.25px;
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--shape-sm);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1px;
}
.cg { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.cr { background: var(--error-container);    color: var(--on-error-container);    }

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--outline-variant);
}
.player-row:last-child { border: none; }

.player-number {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.att-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--outline-variant);
}
.att-row:last-child { border: none; }
.att-name { flex: 1; font-size: 14px; }

.att-tog {
  display: flex;
  border-radius: var(--shape-sm);
  overflow: hidden;
  border: 1px solid var(--outline-variant);
}
.att-tog button {
  padding: 6px 14px;
  border: none;
  cursor: pointer;
  background: var(--surf);
  color: var(--muted);
  transition: all .15s;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.att-tog button .material-symbols-outlined { font-size: 18px; }
.att-tog button.att-present { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.att-tog button.att-absent  { background: var(--error-container);    color: var(--on-error-container);   }

.gbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.gbar::-webkit-scrollbar { display: none; }

.gchip {
  padding: 6px 16px;
  border-radius: var(--shape-full);
  border: 1px solid var(--outline);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  letter-spacing: 0.1px;
}
.gchip.on {
  background: var(--primary-container);
  border-color: transparent;
  color: var(--on-primary-container);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stats-box {
  background: var(--surf);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-lg);
  padding: 16px;
  text-align: center;
}

.stats-number {
  font-size: 32px;
  font-weight: 400;
  font-family: var(--mono);
  line-height: 1;
  color: var(--primary);
}

.stats-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.4px;
}

.bar-wrapper { margin-bottom: 12px; }

.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.bar-header span:last-child {
  color: var(--tertiary);
  font-family: var(--mono);
}

.bar {
  height: 4px;
  background: var(--surf-high);
  border-radius: var(--shape-full);
}
.bar-fill {
  height: 100%;
  border-radius: var(--shape-full);
  background: var(--tertiary);
  transition: width .4s ease;
}
.bar-fill.mid { background: var(--blue); }
.bar-fill.low { background: var(--red);  }

.mnav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.mnav button {
  background: var(--surf);
  border: 1px solid var(--outline-variant);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--shape-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.mnav button .material-symbols-outlined { font-size: 20px; }
.mnav button:hover { background: var(--surf-high); }

.mlabel {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  letter-spacing: 0.15px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.overlay.on { display: flex; }

.modal {
  background: #1C1C1C;
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-xl);
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s cubic-bezier(.2, 0, 0, 1);
  box-shadow: 0 8px 40px rgba(0,0,0,.8), 0 2px 8px rgba(0,0,0,.6);
}

@keyframes modalIn {
  from { transform: translateY(18px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

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

.modal-title {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--shape-full);
  line-height: 1;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.09); }

.slabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}

hr {
  border: none;
  border-top: 1px solid var(--outline-variant);
  margin: 16px 0;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.25px;
}

.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--surf-highest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--shape-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.25px;
  z-index: 300;
  opacity: 0;
  transition: all .22s cubic-bezier(.2, 0, 0, 1);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(0,0,0,.55);
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.no-print   { }
.print-only { display: none; }

@media print {
  :root {
    --bg:        #fff;
    --surface:   #f4f4f4;
    --s2:        #e8e8e8;
    --border:    #ccc;
    --outline-variant: #ccc;
    --text:      #111;
    --muted:     #555;
    --green:     #1a7a1a;
    --red:       #b71c1c;
    --blue:      #003494;
    --tertiary:  #1a7a1a;
    --primary:   #003494;
    --surf-high:     #e0e0e0;
    --surf-highest:  #f4f4f4;
    --surf:          #f4f4f4;
    --tertiary-container: #e8f5e9;
    --on-tertiary-container: #1b5e20;
    --error-container: #ffebee;
    --on-error-container: #b71c1c;
  }
  .topbar, .bnav, #stats-filter-bar, .mnav, .tabs, .no-print { display: none !important; }
  #screen-login { display: none !important; }
  #screen-app   { display: block !important; min-height: unset; }
  .content      { padding: 8px 0; }
  .page         { display: none  !important; }
  #page-stats   { display: block !important; }
  .print-only   { display: block; }
  .card         { border: 1px solid #ccc; page-break-inside: avoid; }
}
