/* SOUBOR: css/style.css (v3.2 - Apple UI Tabs) */
/* POPIS: Kompletní styly s novými login taby (zelená pilulka). */

/* --- DESIGN SYSTEM v20.0 --- */
:root {
  /* Paleta */
  --c-bg: #F2F4F7;           
  --c-card: #FFFFFF;         
  --c-primary: #2C3E50;      
  --c-primary-hover: #1A252F;
  --c-accent: #E64A19;       
  --c-gold: #D4AF37;         
  --c-green: #34C759; /* Apple Green */        
  --c-red: #E74C3C;          
  
  --c-text-main: #1A1A1A;
  --c-text-muted: #8E8E93; /* Apple Gray */
  --c-border: #E2E8F0;

  /* Rozměry */
  --radius: 16px;            
  --radius-sm: 8px;          
  --radius-pill: 50px;       
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
}

/* --- RESET & BASIC --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--c-bg);
  color: var(--c-text-main);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* --- UTILS --- */
.hidden { display: none !important; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--c-text-muted); }
.text-primary { color: var(--c-primary); font-weight: 700; }
.text-accent { color: var(--c-accent); font-weight: 700; }
.text-green { color: var(--c-green); font-weight: 700; }
.full-width { width: 100%; }

/* --- ANIMATIONS --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.anim { animation: fadeUp 0.5s ease-out forwards; opacity: 0; }
.d-1 { animation-delay: 0.05s; }
.d-2 { animation-delay: 0.1s; }
.d-3 { animation-delay: 0.15s; }

/* --- LOADER --- */
#loader {
  position: fixed; inset: 0; background: var(--c-bg); z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.spinner {
  width: 40px; height: 40px; border: 4px solid #ddd; border-top-color: var(--c-primary);
  border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-weight: 600; color: var(--c-text-muted); font-size: 0.9rem; }

/* --- TOAST --- */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
  background: #1A1A1A; color: #fff; padding: 12px 24px; border-radius: var(--radius-pill);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-weight: 600; z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* --- LAYOUT --- */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

/* --- LOGIN SCREEN SPECIFIC & HEADER --- */
.header-wrapper { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  text-align: center; 
  padding-top: 20px; 
  padding-bottom: 20px;
}

.brand-row { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  gap: 12px; 
  margin-bottom: 8px; 
}

.brand-text { 
  font-size: 1.4rem; 
  font-weight: 900; 
  color: var(--c-primary); 
  letter-spacing: 1px; 
  text-transform: uppercase;
  line-height: 1.1;
}

.brand-logo img { 
  width: 60px; 
  height: 60px; 
  border-radius: 50%; 
  box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
  display: block; 
}

/* --- LOGIN TABS (New Apple Style) --- */
.login-tabs-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.login-tab {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--c-text-muted);
  padding: 8px 16px;
  border-radius: 20px; /* Pill shape */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.login-tab:hover {
  color: var(--c-primary);
}

.login-tab.active {
  color: var(--c-green);
  font-weight: 700;
  background-color: rgba(52, 199, 89, 0.1); /* Jemně zelené pozadí */
}

.tab-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.5px;
}

/* --- COMPONENTS: CARDS --- */
.card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative; 
  overflow: hidden;
}
.card-header-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.card-header-line.login-header { justify-content: flex-start; gap: 12px; }
.card-label { text-transform: uppercase; font-size: 0.75rem; font-weight: 800; color: var(--c-text-muted); letter-spacing: 0.5px; }
.card-icon { color: var(--c-primary); margin-right: 0; }


/* --- COMPONENTS: BUTTONS & INPUTS --- */
.btn {
  border: none; padding: 14px 20px; border-radius: 12px;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-secondary { background: #F1F5F9; color: var(--c-text-main); }
.btn-danger { background: var(--c-red); color: #fff; }
.btn-success { background: var(--c-green); color: #fff; }
.btn-link { background: none; color: var(--c-text-muted); font-size: 0.85rem; text-decoration: underline; padding: 5px; }

/* FIX: Mezery mezi inputy */
.input-group {
  margin-bottom: 16px; 
}

.styled-input {
  width: 100%; padding: 14px; background: #F8FAFC;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--c-text-main); outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.styled-input:focus { border-color: var(--c-green); background: #fff; }

/* --- KPI GRID --- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi-card {
  background: var(--c-card); padding: 15px; border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; justify-content: center;
}
.kpi-card.full-width-col { grid-column: span 2; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
.kpi-label { font-size: 0.7rem; font-weight: 800; color: var(--c-text-muted); margin-bottom: 4px; }
.kpi-val { font-size: 1.2rem; font-weight: 800; color: var(--c-text-main); }
.kpi-explain { font-size: 0.75rem; font-weight: 500; color: var(--c-text-muted); }
.kpi-val.green { color: var(--c-green); }

/* --- ADMIN TABLE --- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stats-table { width: 100%; border-collapse: collapse; min-width: 300px; }
.stats-table th { text-align: center; font-size: 0.7rem; color: var(--c-text-muted); border-bottom: 1px solid var(--c-border); padding: 10px 5px; }
.stats-table td { padding: 12px 5px; text-align: center; border-bottom: 1px solid #F1F5F9; font-size: 0.9rem; font-weight: 500; }
.stats-table td:first-child { text-align: left; font-weight: 600; }
.align-left { text-align: left !important; }

/* Toggle Switch */
.toggle-switch { background: #F1F5F9; padding: 3px; border-radius: 8px; display: flex; }
.toggle-btn { 
  flex: 1; border: none; background: none; padding: 6px 12px; 
  font-size: 0.75rem; font-weight: 600; color: var(--c-text-muted); 
  border-radius: 6px; cursor: pointer; 
}
.toggle-btn.active { background: #fff; color: var(--c-primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* --- CALENDAR --- */
.calendar-wrapper {
  background: var(--c-card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px;
}
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.calendar-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; text-transform: capitalize; }
.nav-btn {
  background: #F1F5F9; border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 1.2rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 0.75rem; font-weight: 700;
  color: var(--c-text-muted); margin-bottom: 8px;
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1/1; 
  border-radius: 8px;
  background: #fff;
  border: 1px solid #F1F5F9;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 4px; cursor: pointer; position: relative;
  transition: all 0.2s;
}
.cal-day.empty { background: transparent; border: none; cursor: default; }
.cal-day.today { border-color: var(--c-green); background: #F0FDF4; font-weight: 700; }
.cal-day.past { opacity: 0.5; background: #F9F9F9; }
.day-num { font-size: 0.8rem; font-weight: 600; margin-bottom: 2px; }

.day-status { width: 100%; flex-grow: 1; display: flex; align-items: center; justify-content: center; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-badge-mini {
  font-size: 0.6rem; padding: 2px 4px; border-radius: 4px;
  width: 100%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: none;
}
.s-confirmed { background-color: rgba(52, 199, 89, 0.15); color: var(--c-green); border: 1px solid rgba(52, 199, 89, 0.3); }
.s-confirmed .day-num { color: var(--c-green); }
.s-pending { background-color: rgba(212, 175, 55, 0.15); color: var(--c-gold); border: 1px solid rgba(212, 175, 55, 0.3); } 
.s-pending .day-num { color: #B7950B; }

.calendar-legend { display: flex; justify-content: center; gap: 15px; font-size: 0.75rem; color: var(--c-text-muted); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.confirmed { background: var(--c-green); }
.dot.pending { background: var(--c-gold); }
.dot.free { border: 1px solid #ccc; }

/* --- MODALS --- */
dialog {
  border: none; padding: 0; margin: 0;
  background: transparent;
  width: 100%; max-width: 100%; height: 100%; 
  max-height: 100%;
  position: fixed; z-index: 2000;
  display: none;
  align-items: flex-end; justify-content: center;
}
dialog[open] { display: flex; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }

.modal-content {
  background: #fff; width: 100%; max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 30px 20px 40px 20px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.modal-icon-lg { width: 50px; height: 50px; background: #F1F5F9; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.modal-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.btn-close-abs {
  position: absolute; top: 15px; right: 15px;
  background: #F1F5F9; border: none; width: 30px; height: 30px;
  border-radius: 50%; font-size: 1rem; color: var(--c-text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

@media (min-width: 768px) {
  dialog { align-items: center; } 
  .modal-content { border-radius: 24px; padding: 30px; } 
  .calendar-grid { gap: 8px; }
  .cal-day { height: 80px; align-items: flex-start; padding: 8px; aspect-ratio: auto; }
  .status-badge-mini { display: block; margin-top: auto; }
  .day-status { display: none; }
  .s-confirmed { background-color: #E8F8F5; }
  .s-pending { background-color: #FEF9E7; }
}