/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #1a1a2e;
  --navy-light: #16213e;
  --accent: #4f8ef7;
  --accent-light: #6ba3f9;
  --success: #27ae60;
  --danger: #e74c3c;
  --bg: #f0f2f7;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

body.login-page { background: var(--navy); padding-bottom: 0; }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--navy);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.nav-user { font-size: 14px; color: rgba(255,255,255,0.7); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  transition: color 0.15s;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav .nav-icon { font-size: 22px; margin-bottom: 2px; }

/* ===== CONTAINER ===== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 20px;
}

/* ===== CARD ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
}

/* ===== HERO CARD ===== */
.hero-card {
  background: linear-gradient(135deg, var(--navy) 0%, #2d3470 100%);
  border-radius: var(--radius);
  padding: 22px 18px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  box-shadow: 0 4px 20px rgba(26,26,46,0.3);
}
.date-day { font-size: 20px; font-weight: 700; }
.date-full { font-size: 14px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.hero-status { text-align: center; }
.status-ok, .status-missing {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin: 0 auto 6px;
  font-weight: 700;
}
.status-ok { background: rgba(39,174,96,0.25); color: #2ecc71; }
.status-missing { background: rgba(231,76,60,0.25); color: #e74c3c; }
.status-label { font-size: 11px; color: rgba(255,255,255,0.6); }
.status-hours { font-size: 22px; font-weight: 700; margin-top: 2px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-group input,
.form-group textarea,
.select-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optional { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.hours-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:active { background: #0d0d1a; transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:active { background: var(--bg); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger-outline { border-color: var(--danger); color: var(--danger); }
.mt-2 { margin-top: 10px; }

/* ===== ALERTS ===== */
.alert {
  padding: 13px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 500;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ===== MONTH SUMMARY ===== */
.month-summary {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.summary-item { text-align: center; }
.summary-value { font-size: 26px; font-weight: 800; color: var(--navy); }
.summary-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.summary-divider { width: 1px; height: 40px; background: var(--border); }

/* ===== ENTRIES LIST ===== */
.entries-list { display: flex; flex-direction: column; gap: 2px; }
.entry-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.entry-item:last-child { border-bottom: none; }
.entry-date { font-size: 13px; font-weight: 500; color: var(--text-muted); flex: 1; }
.entry-hours {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
}
.entry-note { font-size: 11px; color: var(--text-muted); }

/* Storico full list */
.entries-list-full { display: flex; flex-direction: column; }
.entry-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.entry-row:last-child { border-bottom: none; }
.entry-info { min-width: 80px; }
.entry-dayname { font-size: 14px; font-weight: 600; color: var(--text); }
.entry-datenum { font-size: 12px; color: var(--text-muted); }
.entry-center { flex: 1; }
.entry-note-text { font-size: 12px; color: var(--text-muted); font-style: italic; }
.entry-right { display: flex; align-items: center; gap: 8px; }
.entry-hours-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(79,142,247,0.1);
  padding: 4px 10px;
  border-radius: 20px;
  min-width: 52px;
  text-align: center;
}
.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}
.btn-delete:active { color: var(--danger); }

/* ===== PAGE HEADER ===== */
.page-header { padding: 4px 0 4px; margin-bottom: 4px; }
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--navy); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 32px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }

/* ===== REPORT OPTIONS ===== */
.option-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.option-card.active { border-color: var(--accent); background: rgba(79,142,247,0.06); }
.option-icon { font-size: 24px; flex-shrink: 0; }
.option-title { font-size: 15px; font-weight: 600; }
.option-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.option-check { color: var(--accent); font-weight: 700; margin-left: auto; }
.option-check.hidden { visibility: hidden; }

/* ===== INFO CARD ===== */
.info-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--navy); }
.info-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.info-list li { 
  font-size: 14px; 
  color: var(--text-muted);
  padding-left: 18px;
  position: relative;
}
.info-list li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; }

/* ===== PROFILE ===== */
.profile-avatar {
  width: 72px; height: 72px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  font-weight: 700;
  margin: 0 auto 10px;
}
.profile-email { text-align: center; font-size: 14px; color: var(--text-muted); }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== LOGIN ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px 20px;
  max-width: 400px;
  margin: 0 auto;
}
.login-logo { text-align: center; margin-bottom: 30px; }
.logo-icon { font-size: 52px; margin-bottom: 10px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: white; }
.login-logo p { font-size: 14px; color: rgba(255,255,255,0.6); margin-top: 4px; }
.login-page .card { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12); backdrop-filter: blur(10px); }
.login-page .form-group label { color: rgba(255,255,255,0.7); }
.login-page input { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: white; }
.login-page input::placeholder { color: rgba(255,255,255,0.4); }
.login-page input:focus { border-color: var(--accent-light); }
.login-page .btn-primary { background: var(--accent); }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; z-index: 999; display: flex; align-items: flex-end; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box {
  position: relative;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-box p { color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ===== SELECT ===== */
.select-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ===== FORM MESSAGE ===== */
#form-message { margin-bottom: 10px; }

/* ===== SUMMARY CARD ===== */
.summary-card .month-summary { padding: 4px 0; }

/* Admin link in navbar */
.nav-right { display: flex; align-items: center; gap: 12px; }
.admin-link {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  background: rgba(255,255,255,0.12);
  padding: 4px 10px;
  border-radius: 20px;
  transition: background 0.15s;
}
.admin-link:hover { background: rgba(255,255,255,0.22); }

/* ===== GIORNI MANCANTI ===== */
.card-warning {
  border-left: 3px solid #f59e0b;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
  margin-bottom: 12px;
}
.missing-days-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.missing-day-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.missing-day-btn:active {
  background: #fef3c7;
  transform: scale(0.98);
}
.missing-day-name {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  min-width: 80px;
}
.missing-day-date {
  font-size: 14px;
  color: #78350f;
  flex: 1;
}
.missing-day-add {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
  background: #fde68a;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ===== STORICO MIGLIORATO ===== */
.entry-missing { background: #fffbeb; }
.entry-weekend { opacity: 0.45; }
.today-badge {
  font-size: 10px;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 5px;
  vertical-align: middle;
}
.btn-edit {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.btn-add-missing {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
  background: #fde68a;
  border: none;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-missing:active { background: #fcd34d; }
