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

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --accent: #a78bfa;
  --accent-glow: rgba(167, 139, 250, 0.3);
  --accent-gradient: linear-gradient(135deg, #a78bfa, #7c3aed);
  --text-primary: #f1f1f7;
  --text-secondary: #9494a6;
  --text-muted: #5c5c6e;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}

.container {
  width: 100%;
  max-width: 1120px;
  padding: 0 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1120px;
  padding: 32px 20px 24px;
  margin-bottom: 8px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

#admin-controls {
  display: flex;
  gap: 8px;
}

.admin-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s ease;
}

.admin-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.admin-btn:active {
  transform: translateY(0);
}

/* Days Grid */
#days-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 20px;
  width: 100%;
  max-width: 1120px;
  margin-bottom: 40px;
}

.day {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.25s ease;
}

.day:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.day h2 {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-primary);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.01em;
}

/* Details / Accordion */
details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: all 0.2s ease;
}

details:hover {
  border-color: var(--border-hover);
}

summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color 0.2s ease;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

details[open] summary::after {
  content: '−';
}

details[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.available-slots {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.75rem;
}

/* Time Slots */
.time-slots-container {
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.time-slot {
  padding: 10px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.time-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.time-slot:not(.reserved):hover {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 0 20px var(--accent-glow);
}

.time-slot:not(.reserved):hover::before {
  opacity: 0.08;
}

.time-slot:not(.reserved):active {
  transform: translateY(0);
}

.time-slot.reserved {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px;
}

.time-slot.reserved:hover {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.12);
}

.reserved-time {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.reserved-name {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.reserved-status {
  color: var(--success);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-secondary);
  margin: 8vh auto;
  padding: 32px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: slideUp 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0 0 20px;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 20px;
  color: var(--text-muted);
  font-size: 1.5rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  background: none;
  border: none;
  padding: 4px;
  font-family: inherit;
}

.close-button:hover {
  color: var(--text-primary);
  transform: rotate(90deg);
}

/* Inputs */
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s ease;
  outline: none;
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.btn-ghost:hover {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.35);
}

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

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-block {
  width: 100%;
}

/* User Info */
#user-info, #reservation-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  margin-bottom: 12px;
  transition: transform 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.05);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.875rem;
}

.info-row + .info-row {
  border-top: 1px solid var(--border-color);
}

.info-label {
  color: var(--text-muted);
}

.info-value {
  color: var(--text-primary);
  font-weight: 500;
}

.action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.action-buttons .btn {
  flex: 1;
}

/* Error / Info messages */
.message-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-top: 16px;
  text-align: center;
}

.message-box.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.message-box.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.toast.info {
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: #c4b5fd;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(24px); }
}

.toast.removing {
  animation: toastOut 0.25s ease forwards;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  width: 100%;
}

/* Responsive */
@media (max-width: 900px) {
  #days-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .header {
    padding: 24px 20px 16px;
  }

  h1 {
    font-size: 1.4rem;
  }
}

@media (max-width: 600px) {
  #days-container {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  #admin-controls {
    width: 100%;
  }

  .admin-btn {
    flex: 1;
    text-align: center;
  }

  .modal-content {
    margin: 4vh auto;
    padding: 24px;
  }

  .time-slots-container {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 1.2rem;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* Skeleton loading animation */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.05) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
