/* ===== APP LAYOUT ===== */
#app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(232, 123, 53, 0.2);
}

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

.back-link {
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 8px 12px;
  display: block;
  transition: color 0.15s;
}

.back-link:hover { color: var(--fg-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  max-width: 1200px;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 16px;
}

.view-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.view-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.back-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 8px;
  padding: 0;
  display: block;
  transition: color 0.15s;
}

.back-btn:hover { color: var(--fg); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: rgba(255,255,255,0.08);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-primary:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-soft);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.8rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255,255,255,0.1);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-meta {
  font-size: 0.82rem;
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.badge-draft {
  background: rgba(255,255,255,0.07);
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.badge-published {
  background: rgba(74, 222, 128, 0.1);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
}

.form-input, .select-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(232, 123, 53, 0.04);
}

.select-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8580' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select-input option {
  background: #1a1a1a;
  color: var(--fg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===== SCHEDULE GRID ===== */
.schedule-week {
  overflow-x: auto;
}

.week-grid {
  display: grid;
  grid-template-columns: 140px repeat(7, 1fr);
  min-width: 900px;
  gap: 0;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
}

.week-header {
  display: contents;
}

.week-col-header {
  background: var(--bg-elevated);
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid rgba(255,255,255,0.04);
}

.week-col-header:last-child { border-right: none; }

.col-day {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.col-date {
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin-top: 2px;
}

.week-staff-header {
  background: var(--bg-elevated);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.week-row {
  display: contents;
}

.week-staff-cell {
  background: var(--bg-card);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.staff-cell-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
}

.staff-cell-role {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.week-day-cell {
  background: var(--bg);
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-right: 1px solid rgba(255,255,255,0.04);
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-day-cell:last-child { border-right: none; }

.shift-pill {
  background: var(--accent-glow);
  border: 1px solid rgba(232, 123, 53, 0.3);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.shift-pill:hover {
  background: rgba(232, 123, 53, 0.2);
  border-color: rgba(232, 123, 53, 0.5);
}

.shift-pill-time {
  font-weight: 600;
}

.shift-delete {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.shift-delete:hover { color: #ef4444; }

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 20px;
}

.stat-card .stat-value {
  font-size: 2rem;
  display: block;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ===== AI NOTES ===== */
.ai-notes {
  background: var(--bg-elevated);
  border: 1px solid rgba(232, 123, 53, 0.15);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.ai-notes-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ai-notes-text {
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ===== GENERATING STATE ===== */
.generating-overlay {
  text-align: center;
  padding: 80px 24px;
}

.generating-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(232, 123, 53, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.generating-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--fg);
  margin-bottom: 8px;
}

.generating-sub {
  font-size: 0.88rem;
  color: var(--fg-muted);
}

/* ===== EMPTY / LOADING ===== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.loading-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ===== TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--fg);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.data-table tr:last-child td { border-bottom: none; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--fg); }

.hidden { display: none !important; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 0.88rem;
  color: var(--fg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast-success { border-color: rgba(74, 222, 128, 0.3); }
.toast-error { border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== AVAILABILITY GRID ===== */
.availability-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.avail-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avail-day-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-align: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.avail-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.avail-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.avail-time {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.avail-time input[type="time"] {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--fg);
  font-size: 0.7rem;
  font-family: var(--font-body);
}

.avail-time input[type="time"]:disabled {
  opacity: 0.3;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-content { padding: 24px 20px; }
  .sidebar { width: 56px; min-width: 56px; padding: 16px 8px; }
  .sidebar .brand-name, .sidebar .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-brand { justify-content: center; padding: 8px; }
}
