/* ============================================================
   style.css - 全局样式
   负责人: Member 3 (C)
   ============================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

/* ==================== Loading ==================== */

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  color: #666;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #1976d2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== Auth ==================== */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

.auth-card h1 {
  text-align: center;
  font-size: 24px;
  color: #1976d2;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  color: #999;
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #eee;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-size: 15px;
  color: #999;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.auth-tab.active {
  color: #1976d2;
  border-bottom-color: #1976d2;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-top: 12px;
}

.auth-form input {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

.auth-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: 12px;
}

/* ==================== Layout ==================== */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.sidebar-header h2 {
  font-size: 18px;
  color: #1976d2;
  font-weight: 700;
}

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

.nav-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: #555;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.nav-btn.active {
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #eee;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1976d2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.user-role {
  font-size: 12px;
  color: #888;
}

/* ==================== Main Content ==================== */

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 24px 32px;
  min-height: 100vh;
}

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

.view-header h2 {
  font-size: 22px;
  color: #333;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-date,
.input-search,
.input-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.input-date:focus,
.input-search:focus,
.input-select:focus {
  outline: none;
  border-color: #1976d2;
}

.input-search {
  min-width: 200px;
}

/* ==================== Room Grid ==================== */

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.room-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-capacity {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.badge-small { background: #4caf50; }
.badge-medium { background: #ff9800; }
.badge-large { background: #f44336; }

.room-status { font-size: 13px; font-weight: 500; }

.room-name {
  font-size: 17px;
  color: #222;
}

.room-location {
  font-size: 13px;
  color: #777;
}

.room-facilities {
  font-size: 13px;
  color: #555;
  background: #f9f9f9;
  padding: 6px 10px;
  border-radius: 6px;
}

.room-desc {
  font-size: 13px;
  color: #888;
}

.room-bookings-today {
  border-top: 1px solid #eee;
  padding-top: 10px;
  margin-top: 4px;
}

.room-bookings-today h4 {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.booking-slot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  color: #555;
}

/* ==================== Tables ==================== */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.data-table th {
  background: #fafafa;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #eee;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

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

.data-table tr:hover td {
  background: #fafafa;
}

/* ==================== Buttons ==================== */

.btn {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: #1976d2;
  color: #fff;
}

.btn-primary:hover {
  background: #1565c0;
  box-shadow: 0 2px 8px rgba(25,118,210,0.3);
}

.btn-outline {
  background: #fff;
  color: #555;
  border: 1px solid #ddd;
}

.btn-outline:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.btn-danger {
  background: #e53935;
  color: #fff;
}

.btn-danger:hover {
  background: #c62828;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 15px;
}

/* ==================== Modal ==================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 18px;
  color: #333;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-room-name {
  font-size: 16px;
  font-weight: 600;
  color: #1976d2;
  margin-bottom: 8px;
}

.modal-body label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-top: 8px;
}

.time-row {
  display: flex;
  gap: 12px;
}

.time-col {
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==================== Inputs ==================== */

.input-full {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.input-full:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

/* ==================== Admin ==================== */

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #eee;
}

.admin-tab {
  padding: 8px 20px;
  border: none;
  background: none;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.admin-tab.active {
  color: #1976d2;
  border-bottom-color: #1976d2;
  font-weight: 600;
}

.admin-toolbar {
  margin-bottom: 16px;
}

/* ==================== Status ==================== */

.status-confirmed {
  color: #4caf50;
  font-weight: 500;
}

.status-cancelled {
  color: #f44336;
  text-decoration: line-through;
}

.text-success { color: #4caf50; }
.text-danger { color: #f44336; }
.text-muted { color: #999; }
.text-center { text-align: center; }

.error-msg {
  color: #e53935;
  font-size: 13px;
  min-height: 20px;
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 60px 20px;
  font-size: 15px;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
  }

  .sidebar-header { padding: 0; border: none; }
  .sidebar-nav { flex-direction: row; padding: 0; }
  .nav-btn { width: auto; }
  .sidebar-footer { display: none; }

  .layout { flex-direction: column; }
  .main-content { margin-left: 0; padding: 16px; }

  .room-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; width: 100%; }
  .view-header { flex-direction: column; }

  .modal { max-width: 95%; margin: 10px; }
  .time-row { flex-direction: column; }
}
