/* =========================================================
   Ore Lucrate - stylesheet
   Directie vizuala: "condica de lucru" - hartie curata, cerneala inchisa,
   accent de chihlimbar (stampila de pontaj), cifre in monospace ca intr-un registru.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F7F5F1;
  --surface: #FFFFFF;
  --surface-alt: #EFEBE3;
  --ink: #1E2A32;
  --ink-soft: #5B6670;
  --ink-faint: #97A0A7;
  --accent: #B8752E;
  --accent-dark: #8F5A1F;
  --accent-soft: #F1E1CB;
  --line: #E4DFD6;
  --success: #2F7D5C;
  --success-soft: #E1F0E7;
  --danger: #B23B3B;
  --danger-soft: #F8E5E3;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-card: 0 1px 2px rgba(30, 42, 50, 0.06), 0 8px 24px rgba(30, 42, 50, 0.06);
  --shadow-modal: 0 -8px 30px rgba(30, 42, 50, 0.18);

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.body--modal-open {
  overflow: hidden;
}

a { color: var(--accent-dark); }

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
}

.hidden { display: none !important; }

/* ---------- Layout shells ---------- */

.app-shell {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: 0 16px 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 8px;
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.topbar__actions {
  display: flex;
  gap: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  border: none;
  border-radius: var(--radius-s);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--surface-alt); }
.btn--danger-text { background: transparent; color: var(--danger); }
.btn--block { width: 100%; justify-content: center; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--ink-soft);
}
.icon-btn--danger { color: var(--danger); }
.icon-btn:disabled { opacity: 0.35; }

/* ---------- Month navigation ---------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
}

.month-nav__label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.month-total {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 12px;
}

/* ---------- Calendar grid ---------- */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 4px;
}

.calendar-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-s);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px;
}

.calendar-cell--empty {
  border: none;
  background: transparent;
}

.calendar-cell__day {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.calendar-cell__hours {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 1px 6px;
}

.calendar-cell--has-entries {
  border-color: var(--accent);
}

.calendar-cell--today .calendar-cell__day {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Toolbar (import/export) ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.toolbar .btn { flex: 1; }

/* ---------- Modal / bottom sheet ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 50, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.modal-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  box-shadow: var(--shadow-modal);
  padding: 10px 20px 24px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.modal-overlay--visible .modal-sheet {
  transform: translateY(0);
}

.modal-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 6px auto 14px;
}

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

.modal-sheet__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

/* ---------- Entry list inside modal ---------- */

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.entry-list__empty {
  color: var(--ink-faint);
  font-size: 14px;
  padding: 12px 0;
}

.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  gap: 10px;
}

.entry-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-row__location {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-row__hours {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-dark);
}

.entry-row__notes {
  font-size: 12px;
  color: var(--ink-soft);
}

.entry-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Forms ---------- */

.form-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--ink-soft);
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-row {
  display: flex;
  gap: 10px;
}
.field-row .field { flex: 1; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.form-actions .btn { flex: 1; }

/* ---------- Toasts ---------- */

#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  width: calc(100% - 32px);
  max-width: 420px;
  align-items: center;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--success); }
.toast--error { background: var(--danger); }
.toast--info { background: var(--ink); }

/* ---------- Login page ---------- */

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

.login-card {
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
}

.login-card__mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 18px;
}

.login-card__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
}

.login-card__subtitle {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 26px;
}

.login-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- Admin page ---------- */

.admin-shell {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 0 16px 40px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 26px;
}

@media (min-width: 560px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-m);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--accent-dark);
}

.stat-card__label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.admin-section {
  background: var(--surface);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.admin-section h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cell-truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-empty {
  color: var(--ink-faint);
  text-align: center;
  padding: 18px 0;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Responsive tweaks ---------- */

@media (max-width: 360px) {
  .calendar-cell__hours { display: none; }
  .app-shell { padding: 0 10px 24px; }
}
