/* Cube Espresso Bar — Staff Scheduler */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:          #F7F2EC;
  --surface:     #FFFFFF;
  --border:      #E4D8CC;
  --espresso:    #2C1A0E;
  --coffee:      #5C3520;
  --latte:       #9B6B4E;
  --cream:       #EDD9C0;
  --text:        #1A0F08;
  --text-muted:  #7A6558;
  --accent:      #C47840;
  --accent-hover:#A86030;
  --success:     #2D7A4F;
  --warning:     #C48040;
  --danger:      #B83030;
  --info:        #2D5F8A;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(44,26,14,0.10);
  --shadow-lg:   0 8px 32px rgba(44,26,14,0.16);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}

/* ── Auth screen ─────────────────────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #2C1A0E 0%, #5C3520 60%, #9B6B4E 100%);
}

.auth-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .store-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--espresso);
  letter-spacing: -0.3px;
}
.auth-logo .tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .2s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--cream); color: var(--espresso); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-full      { width: 100%; }
.btn-sm        { padding: 6px 12px; font-size: 12px; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── App shell ───────────────────────────────────────────────────────────── */
#app-screen { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--espresso);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.topbar-brand { font-size: 16px; font-weight: 700; letter-spacing: -.2px; flex: 1; }
.topbar-brand span { color: var(--cream); opacity: .7; font-weight: 400; font-size: 13px; margin-left: 8px; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.topbar-nav button:hover, .topbar-nav button.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.topbar-user {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Views ───────────────────────────────────────────────────────────────── */
.view { display: none; flex: 1; overflow: hidden; flex-direction: column; padding: 20px 24px; }
.view.active { display: flex; }

.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.view-title { font-size: 20px; font-weight: 700; color: var(--espresso); }

/* ── Schedule view ───────────────────────────────────────────────────────── */
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.period-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
}
.period-label { font-size: 14px; font-weight: 600; color: var(--espresso); min-width: 220px; text-align: center; }
.nav-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 6px;
  transition: all .15s;
}
.nav-btn:hover { background: var(--bg); color: var(--espresso); }

.schedule-wrap {
  flex: 1;
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.schedule-grid {
  display: flex;
  min-width: max-content;
}

/* Left sidebar: employee names */
.schedule-sidebar {
  flex-shrink: 0;
  width: 160px;
  background: var(--espresso);
  color: #fff;
  border-right: 1px solid rgba(255,255,255,.1);
}
.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,.5);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-employee {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: grab;
  transition: background .15s;
  user-select: none;
}
.sidebar-employee:hover   { background: rgba(255,255,255,.08); }
.sidebar-employee:active  { cursor: grabbing; }
.sidebar-employee.dragging { opacity: .5; }
.emp-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.emp-name-text {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Calendar columns */
.schedule-calendar { flex: 1; }
.calendar-header {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.day-header {
  flex: 1;
  min-width: 100px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  gap: 2px;
}
.day-header .day-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--espresso);
  line-height: 1;
}
.day-header.today .day-num { color: var(--accent); }
.day-header.weekend { background: var(--bg); }

.calendar-body { display: flex; flex-direction: column; }
.employee-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.employee-row:last-child { border-bottom: none; }

.day-cell {
  flex: 1;
  min-width: 100px;
  min-height: 52px;
  border-right: 1px solid var(--border);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  transition: background .15s;
}
.day-cell.weekend { background: #fdfaf7; }
.day-cell.drag-over { background: #FFF3E0; outline: 2px dashed var(--accent); outline-offset: -2px; }
.day-cell.has-leave { background: #fff5f5; }
.day-cell.has-unavail { background: #f5f0ff; }

.day-cell-add {
  position: absolute;
  bottom: 3px;
  right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--latte);
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-cell:hover .day-cell-add { opacity: 1; }

.shift-block {
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  transition: filter .15s;
}
.shift-block:hover { filter: brightness(1.1); }
.shift-block .shift-time { font-size: 10px; font-weight: 400; opacity: .85; white-space: nowrap; }
.shift-del {
  background: rgba(0,0,0,.2);
  border: none;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  padding: 1px 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.shift-block:hover .shift-del { opacity: 1; }

.conflict-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
}
.conflict-leave   { background: #FFE0E0; color: var(--danger); }
.conflict-unavail { background: #EDE0FF; color: #6B21A8; }

/* ── Employees view ──────────────────────────────────────────────────────── */
.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  overflow-y: auto;
}

.employee-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  transition: box-shadow .2s;
}
.employee-card:hover { box-shadow: var(--shadow-lg); }

.emp-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.emp-info { flex: 1; min-width: 0; }
.emp-info-name  { font-size: 15px; font-weight: 600; color: var(--espresso); }
.emp-info-role  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-top: 2px; }
.emp-info-meta  { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }

/* ── Leave view ──────────────────────────────────────────────────────────── */
.leave-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.leave-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.leave-info { flex: 1; }
.leave-name  { font-weight: 600; font-size: 14px; color: var(--espresso); }
.leave-dates { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.leave-reason{ font-size: 12px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.leave-actions { display: flex; gap: 8px; flex-shrink: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-pending  { background: #FFF3CD; color: #856404; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title  { font-size: 18px; font-weight: 700; color: var(--espresso); }
.modal-close  { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); border-radius: 6px; padding: 4px 8px; transition: background .15s; }
.modal-close:hover { background: var(--bg); }
.modal-footer { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--espresso);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Employee my-schedule view ───────────────────────────────────────────── */
.my-shifts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.my-shift-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.my-shift-date {
  min-width: 56px;
  text-align: center;
}
.my-shift-date .day-abbr { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.my-shift-date .day-n    { font-size: 24px; font-weight: 700; line-height: 1; color: var(--espresso); }
.my-shift-sep { width: 3px; height: 40px; border-radius: 2px; }
.my-shift-info { flex: 1; }
.my-shift-time { font-size: 15px; font-weight: 600; color: var(--espresso); }
.my-shift-pos  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Availability day chips ──────────────────────────────────────────────── */
.day-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.day-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  user-select: none;
}
.day-chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Conflict warning ────────────────────────────────────────────────────── */
.conflict-warning {
  background: #FFF3CD;
  border: 1.5px solid #FBBF24;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #7C5200;
  margin-bottom: 14px;
  display: none;
}
.conflict-warning.visible { display: block; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex-gap { display: flex; gap: 8px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 16px; margin-bottom: 8px; }

hr.divider { border: none; border-top: 1.5px solid var(--border); margin: 16px 0; }

.color-picker-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: var(--espresso); transform: scale(1.1); }

@media (max-width: 640px) {
  .schedule-sidebar { width: 120px; }
  .auth-card { padding: 24px; }
  .topbar-brand span { display: none; }
}
