/* ═══════════════════════════════════════════════════════════════
   GESTIONALE ASSENZE — style.css
   Palette "Ocean" · glowup online / rednote 279595670
   ═══════════════════════════════════════════════════════════════ */

/* ─── PALETTE SOURCE ─────────────────────────────────────────── */
/*
  DEEP BLUE    #2A4D88   rgb(42, 77, 136)    cmyk(69,43,0,47)
  CONCERTO     #D9D9D8   rgb(217,217,216)    cmyk(0,0,0,15)
  GLACIAL SALT #B1BBC8   rgb(177,187,200)    cmyk(12,7,0,22)
  OCEAN CITY   #7C94B8   rgb(124,148,184)    cmyk(33,20,0,28)
*/

/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  /* ── palette ── */
  --deep-blue:    #2A4D88;
  --concerto:     #D9D9D8;
  --glacial-salt: #B1BBC8;
  --ocean-city:   #7C94B8;

  /* ── semantic roles ── */
  --sidebar:      var(--deep-blue);           /* sidebar, table headers          */
  --sidebar-deep: #1e3a6e;                    /* sidebar hover/pressed state     */
  --accent:       #c0392b;                    /* danger, errors, delete           */
  --accent2:      var(--ocean-city);          /* interactive: focus, links, CTAs  */
  --accent2-dark: #5a7a9e;                    /* hover state of accent2           */

  --bg:           #eef0f4;                    /* page background (Glacial Salt ↓) */
  --surface:      #ffffff;                    /* cards, modals                    */
  --border:       var(--concerto);            /* borders & dividers               */
  --border-focus: var(--ocean-city);          /* input focus ring                 */

  --text:         #1c2b3a;                    /* primary text                     */
  --text-muted:   #6b7a8d;                    /* secondary / labels               */

  --success:      #2d6a4f;
  --warning:      #b45309;

  /* ── misc ── */
  --radius:       6px;
  --shadow:       0 1px 4px rgba(42,77,136,0.07), 0 4px 16px rgba(42,77,136,0.09);
}

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

/* ─── BASE ───────────────────────────────────────────────────── */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════
   AUTH SCREEN (login / registrati)
══════════════════════════════════════════════════════════════ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar);
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent, transparent 40px,
      rgba(255,255,255,0.015) 40px, rgba(255,255,255,0.015) 41px
    );
}

.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 48px 40px;
  width: 360px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.login-logo {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 32px;
  text-align: center;
}

.login-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
  text-align: center;
}

.login-title span {
  color: var(--deep-blue);           /* was accent red → now Deep Blue */
}

/* ── Auth tab toggle ── */
.auth-toggle {
  display: flex;
  margin-bottom: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
  background: transparent;
  border: none;
  font-family: 'DM Sans', sans-serif;
}

.auth-tab.active {
  background: var(--sidebar);
  color: #ffffff;
}

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

/* ── Pending registration banner ── */
.pending-banner {
  background: #e8f0fb;               /* light Deep Blue tint */
  border: 1.5px solid var(--glacial-salt);
  color: var(--deep-blue);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
  display: none;
}

.pending-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

/* ── Form elements ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  background: #ffffff;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--deep-blue);      /* was accent red → Deep Blue */
  color: #ffffff;
  width: 100%;
  justify-content: center;
  padding: 12px;
}
.btn-primary:hover { background: var(--sidebar-deep); }

.btn-secondary {
  background: var(--concerto);
  color: var(--text);
}
.btn-secondary:hover { background: var(--glacial-salt); }

.btn-outline {
  background: transparent;
  color: var(--ocean-city);
  border: 1.5px solid var(--ocean-city);
}
.btn-outline:hover {
  background: var(--ocean-city);
  color: #ffffff;
}

.btn-danger {
  background: #fde8e8;
  color: var(--accent);
}
.btn-danger:hover {
  background: var(--accent);
  color: #ffffff;
}

.btn-success {
  background: #d1fae5;
  color: var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: #ffffff;
}

/* ── Messages ── */
.error-msg {
  background: #fde8e8;
  color: var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════════════════════ */
#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--sidebar);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 4px;
}

.sidebar-appname {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
}

.sidebar-user-meta {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.35);
  margin-top: 3px;
}

.badge-admin {
  display: inline-block;
  background: var(--ocean-city);     /* was accent red → Ocean City */
  color: #ffffff;
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-item:hover  { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(255,255,255,0.12); color: #ffffff; }
.nav-item .icon  { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Main area ── */
.main {
  padding: 32px 36px;
  overflow-y: auto;
}

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

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   CALENDAR
══════════════════════════════════════════════════════════════ */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.cal-month-title {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  min-width: 160px;
  text-align: center;
}

.cal-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.cal-btn:hover {
  border-color: var(--ocean-city);
  color: var(--ocean-city);
}

.calendar-grid {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Weekday header strip */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--sidebar);
}

.cal-weekday {
  text-align: center;
  padding: 10px 4px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

/* Day grid */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 72px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.cal-day:nth-child(7n) { border-right: none; }

.cal-day.empty   { background: #f2f4f7; cursor: default; }          /* Glacial tint */
.cal-day.weekend { background: #f2f4f7; cursor: not-allowed; }
.cal-day.past    { opacity: 0.4; cursor: not-allowed; }
.cal-day.today   { background: #e8f0fb; }                           /* Deep Blue tint */

.cal-day:hover:not(.empty):not(.past):not(.weekend):not(.deadline) {
  background: #dce8f7;               /* Ocean City hover tint */
}

/* Deadline striped overlay */
.cal-day.deadline {
  opacity: 0.45;
  cursor: not-allowed;
  background: repeating-linear-gradient(
    135deg,
    transparent, transparent 4px,
    rgba(42,77,136,0.06) 4px, rgba(42,77,136,0.06) 5px
  );
}

/* Day number */
.cal-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.cal-day.today .cal-day-num {
  background: var(--deep-blue);      /* was red → Deep Blue */
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.cal-day.weekend .cal-day-num { color: var(--text-muted); }

.deadline-tag {
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  color: var(--deep-blue);
  margin-top: 3px;
  letter-spacing: 0.05em;
}

/* Calendar events */
.cal-events {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-event {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Palette-matched event colours */
.cal-event.mine     { background: #d2dff5; color: var(--deep-blue); }     /* Deep Blue tint */
.cal-event.other    { background: #e2e8f2; color: #3d5475; }              /* Glacial Salt tint */
.cal-event.approved { background: #d1fae5; color: var(--success); }
.cal-event.rejected { background: #fde8e8; color: var(--accent); }

/* Legend */
.legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,44,72,0.5);   /* Deep Blue tinted scrim */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: 10px;
  padding: 28px;
  width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-title span {
  color: var(--ocean-city);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--sidebar);
  color: rgba(255,255,255,0.5);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 11px 16px;
  text-align: left;
  font-weight: 400;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: #f0f4fa; }  /* Deep Blue micro-tint */

td {
  padding: 12px 16px;
  font-size: 13px;
}

/* ── Status badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-pending  { background: #e8f0fb; color: var(--deep-blue); }    /* Deep Blue tint */
.badge-approved { background: #d1fae5; color: var(--success); }
.badge-rejected { background: #fde8e8; color: var(--accent); }

/* ── Department tag ── */
.dept-block {
  display: inline-block;
  background: var(--deep-blue);
  color: rgba(255,255,255,0.75);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
}

/* ══════════════════════════════════════════════════════════════
   FILTERS
══════════════════════════════════════════════════════════════ */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select,
.filters input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.filters select:focus,
.filters input:focus {
  border-color: var(--border-focus);
}

/* ══════════════════════════════════════════════════════════════
   STATS CARDS
══════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

/* ══════════════════════════════════════════════════════════════
   MISC
══════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 36px; margin-bottom: 12px; }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sidebar);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 200;
  display: none;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #app                 { grid-template-columns: 1fr; }
  .sidebar             { position: relative; height: auto; }
  .main                { padding: 20px; }
  .stats-grid          { grid-template-columns: 1fr; }
}
