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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
  --room-a: #818cf8;
  --room-b: #34d399;
  --room-c: #fbbf24;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Nav */
.nav {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav a:hover {
  color: white;
}

.nav-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.btn-logout {
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container-sm {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Form */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

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

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-gcal {
  background: #1a73e8;
  color: white;
}

.btn-gcal:hover {
  background: #1557b0;
}

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

.btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Alert */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Zoom stats */
.zoom-stats {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

/* Calendar */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.calendar-header h2 {
  margin: 0;
}

.calendar-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.calendar-nav button {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.calendar-nav button:hover {
  background: #f1f5f9;
}

.calendar-grid {
  display: grid;
  overflow-x: auto;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.calendar-table th,
.calendar-table td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
  font-size: 0.8rem;
  height: 48px;
  min-width: 60px;
  position: relative;
}

.calendar-table th {
  background: #f8fafc;
  padding: 0.4rem 0.25rem;
  font-weight: 500;
  position: sticky;
  top: 0;
}

.calendar-table th.room-header {
  width: 100px;
  min-width: 100px;
}

.calendar-table td.room-label {
  font-weight: 600;
  background: #f8fafc;
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 0 0.5rem;
}

.calendar-table td.time-slot {
  cursor: pointer;
  transition: background 0.1s;
}

.calendar-table td.time-slot:hover {
  background: #e0e7ff;
}

.booking-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  color: white;
  font-size: 0.7rem;
  padding: 2px 4px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.booking-block.room-1 {
  background: var(--room-a);
}

.booking-block.room-2 {
  background: var(--room-b);
  color: #064e3b;
}

.booking-block.room-3 {
  background: var(--room-c);
  color: #78350f;
}

/* Day tabs */
.day-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.day-tab {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.day-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.day-tab:hover:not(.active) {
  background: #f1f5f9;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin-bottom: 0.75rem;
}

.modal p {
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.modal .close-btn {
  margin-top: 1rem;
  display: block;
  width: 100%;
}

.modal .btn-group {
  margin-top: 1rem;
}

/* Info list */
.info-list dt {
  font-weight: 500;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.info-list dd {
  font-size: 1rem;
  margin-left: 0;
}

/* Zoom ID grouping */
.zoom-id-group {
  margin-right: 0.35em;
}

.zoom-id-group:last-child {
  margin-right: 0;
}

/* User table */
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.user-table th,
.user-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.user-table th {
  font-weight: 600;
  background: #f8fafc;
  font-size: 0.85rem;
  color: var(--text-light);
}

.user-table tr:hover {
  background: #f8fafc;
}

.action-cell {
  display: flex;
  gap: 0.25rem;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* Password toggle */
.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 2.5rem !important;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1;
}

.password-toggle:hover {
  color: var(--text);
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 640px) {
  .nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .calendar-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .container {
    padding: 1rem;
  }
}
