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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #0ea5e9;
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-color: #f8fafc;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background: 
    radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.15) 0%, transparent 40%),
    var(--bg-color);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Base resets */
* { box-sizing: border-box; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
button { font-family: inherit; border: none; outline: none; cursor: pointer; }

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-controls label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 14px;
}

.user-controls select {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: white;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s;
}
.user-controls select:hover {
  border-color: var(--primary);
}

.ghost-link {
  padding: 10px 20px;
  border-radius: 10px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.2s;
}
.ghost-link:hover {
  background: var(--primary);
  color: white;
}

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  gap: 24px;
  padding: 32px;
  max-width: 1800px;
  margin: 0 auto;
  align-items: stretch;
}

/* Glass Panels */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--glass-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.panel:hover {
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.1);
}

.panel h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel h2::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 4px;
  display: inline-block;
}

/* Left Panel */
.rule-list {
  list-style: none;
  display: grid;
  gap: 12px;
  margin-bottom: 32px;
}
.rule-list li {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.rule-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: rgba(255, 255, 255, 0.5);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.dot.available { background: white; border: 2px solid #cbd5e1; }
.dot.selected { background: var(--primary); border: 2px solid var(--primary); }
.dot.blocked { background: #e2e8f0; border: 2px solid #94a3b8; }
.dot.assigned { background: var(--danger); border: 2px solid var(--danger); }
.dot.mine { background: var(--success); border: 2px solid var(--success); }

.notice {
  margin-top: 24px;
  padding: 16px;
  background: rgba(14, 165, 233, 0.1);
  border-left: 4px solid var(--secondary);
  border-radius: 0 12px 12px 0;
  font-size: 13px;
  color: #0c4a6e;
  line-height: 1.6;
}

.zoom-panel {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
.zoom-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(0,0,0,0.05);
  font-size: 18px;
  color: var(--text-main);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.2s;
}
.zoom-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.2);
}

/* Map Panel */
.map-panel {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--glass-shadow);
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.seat-map {
  flex: 1;
  border-radius: 16px;
  background: white;
  position: relative;
  overflow: hidden;
  cursor: grab;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}
.seat-map:active {
  cursor: grabbing;
}

.seat-map-content {
  position: absolute;
  width: 820px;
  height: 1000px;
  transform-origin: 0 0;
  will-change: transform;
}

/* SVG Styling */
.office-plan {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
.room-fill { fill: #f8fafc; }
.outer-wall { fill: none; stroke: #334155; stroke-width: 4; stroke-linejoin: round; }
.inner-wall { fill: none; stroke: #64748b; stroke-width: 2.5; stroke-linejoin: round; }
.window-line { fill: none; stroke: #38bdf8; stroke-width: 3; stroke-linecap: round; }
.door-line { fill: none; stroke: #0f172a; stroke-width: 2; stroke-linecap: round; }
.partition { fill: none; stroke: #cbd5e1; stroke-width: 1.5; }
.desk { fill: #fef3c7; stroke: #d97706; stroke-width: 1; rx: 4; ry: 4; }
.desk-line, .fixture-line { stroke: #fbbf24; stroke-width: 0.8; }
.fixture { fill: #f1f5f9; stroke: #94a3b8; stroke-width: 1; rx: 2; ry: 2; }

/* Seats */
.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}/* Desks */
.seat.chair-up, .seat.chair-down { width: 72px; height: 44px; }
.seat.chair-left, .seat.chair-right { width: 44px; height: 72px; }

.seat:hover {
  z-index: 200 !important;
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.desk-id {
  font-size: 15px;
  font-weight: 800;
  color: #334155;
  z-index: 2;
  transition: color 0.2s;
}

.chair {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
  z-index: 1;
}
.seat:not([data-count="0"]) .chair { color: #64748b; }

.seat.chair-up .chair { top: -32px; left: 50%; margin-left: -12px; }
.seat.chair-down .chair { bottom: -32px; left: 50%; margin-left: -12px; }
.seat.chair-left .chair { left: -32px; top: 50%; margin-top: -12px; }
.seat.chair-right .chair { right: -32px; top: 50%; margin-top: -12px; }

.seat:hover .chair {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.floating-badge {
  position: absolute;
  background: var(--primary);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  z-index: 250;
  pointer-events: none;
}
.floating-badge.chair-up, .floating-badge.chair-down {
  transform: translate(calc(-50% + 24px), calc(-50% - 10px));
}
.floating-badge.chair-left, .floating-badge.chair-right {
  transform: translate(calc(-50% + 10px), calc(-50% - 24px));
}

/* States */
.seat.available:hover { border-color: var(--primary); }
.seat.available:hover .desk-id { color: var(--primary); }
.seat.available:hover .chair { border-color: var(--primary); color: var(--primary); }

.seat.selected {
  background: #eef2ff;
  border-color: var(--primary);
}
.seat.selected .desk-id { color: var(--primary); }
.seat.selected .chair {
  border-color: var(--primary);
  background: white;
  color: var(--primary);
}

.seat[data-count]:not([data-count="0"]) .chair {
  background: #fffbeb;
  border-color: var(--warning);
  color: #b45309;
}
.seat.selected[data-count]:not([data-count="0"]) .chair {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.seat.blocked { background: #f1f5f9; border-color: #e2e8f0; cursor: not-allowed; }
.seat.blocked .desk-id { color: #cbd5e1; }
.seat.blocked .chair { background: #f8fafc; border-color: #e2e8f0; }

.seat.assigned { background: #fff1f2; border-color: var(--danger); cursor: not-allowed; }
.seat.assigned .desk-id { color: #e11d48; }
.seat.assigned .chair { background: var(--danger); border-color: var(--danger); color: white; }

.seat.mine { background: #ecfdf5; border-color: var(--success); }
.seat.mine .desk-id { color: #059669; }
.seat.mine .chair { background: var(--success); border-color: var(--success); color: white; }

/* Right Panel */
.profile-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
  border: 1px solid white;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.profile-card strong { font-size: 20px; font-weight: 800; color: var(--primary); }
.profile-card span { font-size: 14px; color: var(--text-muted); font-weight: 500; }

.selected-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.selected-list li {
  background: white;
  border: 1px solid rgba(0,0,0,0.05);
  padding: 16px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s;
}
.selected-list li:hover {
  transform: translateX(4px);
  border-color: rgba(79, 70, 229, 0.3);
}
.selected-list li.empty {
  color: #94a3b8;
  background: rgba(255,255,255,0.5);
  border-style: dashed;
  font-weight: 500;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-muted);
}
.progress-row strong {
  color: var(--primary);
  font-size: 16px;
}

.progress-bar {
  height: 12px;
  background: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 12px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn, .secondary-btn, .danger-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
  margin-bottom: 16px;
}
.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(79, 70, 229, 0.35);
}
.primary-btn:active:not(:disabled) {
  transform: translateY(0);
}

.secondary-btn {
  background: white;
  color: var(--text-muted);
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}
.secondary-btn:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
  background: #fff1f2;
}

.danger-btn {
  background: #fff1f2;
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.status-text {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: #0f172a;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  padding: 18px 24px 28px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* Admin Page Specifics */
.admin-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel.wide { grid-column: 1 / -1; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-grid div {
  background: white;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}
.stat-grid span { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.stat-grid strong { display: block; margin-top: 8px; font-size: 28px; color: var(--primary); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; font-weight: 600; }
.field select, .field input {
  padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.1);
  background: white; font-family: inherit; font-size: 15px;
}

.button-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.seat-checklist {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; margin-bottom: 24px;
}
.seat-checklist label {
  display: flex; align-items: center; gap: 8px; padding: 10px; background: white;
  border: 1px solid rgba(0,0,0,0.1); border-radius: 10px; cursor: pointer; font-weight: 500; transition: all 0.2s;
}
.seat-checklist label:hover { border-color: var(--primary); }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.05); }
th { background: #f8fafc; color: var(--text-muted); font-weight: 600; font-size: 14px; }
td select { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); }

.log-list { display: flex; flex-direction: column; gap: 12px; }
.log-item { background: white; padding: 16px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.05); }
.log-item small { color: var(--text-muted); display: block; margin-bottom: 4px; }

/* Responsive Adjustments */
@media (max-width: 1400px) {
  .workspace { grid-template-columns: 280px 1fr 300px; padding: 24px; }
}
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
  .map-panel { height: 600px; }
  .admin-layout { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 16px; }
  .workspace, .admin-layout { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .button-row { grid-template-columns: 1fr; }
}
