/* ===========================
   Design System - CSS Variables
   =========================== */
:root {
  /* Backgrounds */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #252836;
  --bg-surface: #2a2d3a;

  /* Accent (Blue) */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-active: #1d4ed8;
  --accent-glow: rgba(59, 130, 246, 0.3);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Status Colors */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.15);

  /* Borders & Surfaces */
  --border-color: #2e3347;
  --border-focus: #3b82f6;
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --glass-bg: rgba(26, 29, 39, 0.9);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   Base & Reset
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: white;
}

/* ===========================
   Desk Cards
   =========================== */
.desk-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* Subtle gradient overlay */
.desk-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

/* === Free Desk === */
.desk-free {
  cursor: pointer;
  border-color: rgba(59, 130, 246, 0.2);
}

.desk-free::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
  opacity: 1;
}

.desk-free:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  transform: translateY(-4px);
}

.desk-free:hover::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, transparent 60%);
}

.desk-free:active {
  transform: translateY(-1px);
}

/* === Occupied Desk === */
.desk-occupied {
  cursor: not-allowed;
  border-color: rgba(239, 68, 68, 0.15);
  opacity: 0.7;
}

.desk-occupied::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.04) 0%, transparent 60%);
  opacity: 1;
}

/* === Card Icon === */
.desk-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all var(--transition-base);
}

.desk-free .desk-card-icon {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.desk-free:hover .desk-card-icon {
  background: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
}

.desk-occupied .desk-card-icon {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.desk-card-icon svg {
  width: 24px;
  height: 24px;
}

/* === Card Number === */
.desk-card-number {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* === Card Status === */
.desk-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.desk-free .desk-card-status {
  color: var(--accent);
}

.desk-occupied .desk-card-status {
  color: var(--error);
}

.desk-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-free {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.dot-occupied {
  background: var(--error);
}

/* === Card Action Hint === */
.desk-card-action {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-base);
}

.desk-free:hover .desk-card-action {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Overlay
   =========================== */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn var(--transition-base) forwards;
}

/* ===========================
   Modal
   =========================== */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  z-index: 1001;
  min-width: 320px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modalIn var(--transition-slow) forwards;
}

.modal h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal label {
  display: block;
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.modal input[type="date"],
.modal input[type="time"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  color-scheme: dark;
}

.modal input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ===========================
   Buttons
   =========================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
  background: var(--accent-active);
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* ===========================
   Toast Notifications
   =========================== */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast-success {
  background: var(--bg-secondary);
  border-color: var(--success);
  border-left: 4px solid var(--success);
}

.toast-error {
  background: var(--bg-secondary);
  border-color: var(--error);
  border-left: 4px solid var(--error);
}

.toast-info {
  background: var(--bg-secondary);
  border-color: var(--info);
  border-left: 4px solid var(--info);
}

.toast-warning {
  background: var(--bg-secondary);
  border-color: var(--warning);
  border-left: 4px solid var(--warning);
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast-message {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1.125rem;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ===========================
   Keyframe Animations
   =========================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes modalOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ===========================
   Logout Button
   =========================== */
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.logout-btn:active {
  transform: scale(0.97);
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 640px) {
  .modal {
    min-width: unset;
    width: calc(100% - 24px);
    padding: 20px;
    border-radius: var(--radius-md);
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 32px);
  }

  .desk-card {
    padding: 20px 16px;
  }

  .desk-card-icon {
    width: 40px;
    height: 40px;
  }

  .desk-card-icon svg {
    width: 20px;
    height: 20px;
  }
}
