/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #10b981;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
}
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .15s ease; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--accent:hover:not(:disabled) { background: #15803d; }
.btn--outline { background: transparent; color: var(--gray-700); border-color: var(--gray-300); }
.btn--outline:hover:not(:disabled) { background: var(--gray-100); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--sm { padding: 4px 12px; font-size: .8125rem; }
.btn--lg { padding: 12px 24px; font-size: 1rem; }
.btn--block { width: 100%; justify-content: center; }

/* ===== Header ===== */
.header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header__inner {
  display: flex; align-items: center;
  height: 60px; gap: 32px;
}
.logo { font-size: 1.375rem; font-weight: 700; color: var(--primary) !important; text-decoration: none !important; }
.nav { display: flex; gap: 20px; flex: 1; }
.nav__link { color: var(--gray-600) !important; font-size: .9375rem; font-weight: 500; text-decoration: none !important; }
.nav__link:hover, .nav__link--active { color: var(--primary) !important; }
.header__auth { display: flex; gap: 8px; align-items: center; position: relative; }

.user-menu { position: relative; display: inline-block; }
.user-menu__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}
.user-menu__dropdown--open { display: block; }
.user-menu__item {
  display: block;
  padding: 10px 16px;
  font-size: .875rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
}
.user-menu__item:hover { background: var(--gray-100); }
.user-menu__divider {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--gray-200);
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: #fff;
  padding: 80px 0 64px;
  text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 12px; }
.hero p { font-size: 1.125rem; opacity: .9; max-width: 600px; margin: 0 auto 32px; }
.search-bar {
  display: flex; gap: 12px; max-width: 560px; margin: 0 auto;
  background: #fff; border-radius: var(--radius-lg);
  padding: 6px; box-shadow: var(--shadow-lg);
}
.search-bar input {
  flex: 1; border: none; padding: 12px 16px;
  font-size: 1rem; outline: none;
  background: transparent; color: var(--gray-800);
}
.search-bar input::placeholder { color: var(--gray-400); }

/* ===== Categories ===== */
.categories-section { padding: 48px 0; }
.categories-section h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 24px; }
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.category-card {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; background: #fff; border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  cursor: pointer; transition: all .15s ease;
  font-weight: 500; color: var(--gray-700);
}
.category-card:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-md); }
.category-card__icon { font-size: 1.5rem; }

/* ===== Specialists ===== */
.specialists-section { padding: 32px 0; }
.specialists-section h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 20px; }
.specialist-card {
  display: flex; gap: 20px;
  background: #fff; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px; margin-bottom: 16px;
  transition: box-shadow .15s ease;
}
.specialist-card:hover { box-shadow: var(--shadow-md); }
.specialist-card__avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; flex-shrink: 0; color: var(--primary);
  overflow: hidden;
}
.specialist-card__avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.specialist-card__body { flex: 1; }
.specialist-card__name { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); }
.specialist-card__spec { color: var(--primary); font-size: .875rem; font-weight: 500; margin: 2px 0 8px; }
.specialist-card__meta { display: flex; gap: 16px; flex-wrap: wrap; }
.specialist-card__meta span { font-size: .8125rem; color: var(--gray-500); display: flex; align-items: center; gap: 4px; }
.specialist-card__actions { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.price { font-size: 1.125rem; font-weight: 700; color: var(--accent); }

/* ===== Orders ===== */
.orders-section { padding: 32px 0; }
.order-card {
  background: #fff; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px; margin-bottom: 12px;
}
.order-card__header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.order-card__title { font-weight: 600; font-size: 1rem; }
.order-card__status {
  font-size: .75rem; padding: 2px 8px; border-radius: 9999px;
  font-weight: 600; text-transform: uppercase;
}
.status--pending { background: #fef3c7; color: #92400e; }
.status--accepted { background: #dbeafe; color: #1e40af; }
.status--completed { background: #d1fae5; color: #065f46; }
.status--cancelled { background: #fce4ec; color: #b71c1c; }
.status--redirected { background: #ede9fe; color: #5b21b6; }
.status--rescheduled { background: #f3e8ff; color: #6b21a8; }

/* ===== Auth Modal ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal__backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
}
.modal__body {
  position: relative; background: #fff; border-radius: var(--radius-lg);
  width: 100%; max-width: 400px; padding: 32px; box-shadow: var(--shadow-lg);
  margin: 20px;
}
.modal__close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--gray-400); line-height: 1;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.form-group input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: .9375rem; outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-switch { text-align: center; margin-top: 12px; font-size: .875rem; color: var(--gray-500); }
.form-switch a { cursor: pointer; }
.form-error { color: var(--danger); font-size: .8125rem; margin-top: 4px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: var(--radius);
  color: #fff; font-size: .875rem; font-weight: 500;
  z-index: 300; animation: slideIn .3s ease;
}
.toast--success { background: var(--accent); }
.toast--error { background: var(--danger); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== Loading & Empty ===== */
.spinner { display: flex; justify-content: center; padding: 40px; }
.spinner::after {
  content: ''; width: 32px; height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state__icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.125rem; color: var(--gray-700); margin-bottom: 4px; }

/* ===== Profile Page ===== */
.profile-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .profile-grid-2col { grid-template-columns: 1fr; }
}

.profile-form label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--gray-600);
  margin: 12px 0 4px;
}
.profile-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .9375rem;
  outline: none;
  transition: border-color .15s;
}
.profile-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ===== Calendar ===== */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-title {
  font-size: 1rem;
  font-weight: 600;
}
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-name {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 6px 0;
}
.cal-day {
  text-align: center;
  padding: 8px 0;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--text);
  background: var(--gray-50);
}
.cal-day--empty { background: transparent; }
.cal-day--today {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.cal-day--pending {
  background: #fef9c3;
  color: #a16207;
  font-weight: 600;
  position: relative;
}
.cal-day--pending::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ca8a04;
}
.cal-day--confirmed {
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  position: relative;
}
.cal-day--confirmed::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
}
.cal-day--cancelled {
  background: #fef2f2;
  color: #991b1b;
  font-weight: 600;
  position: relative;
}
.cal-day--cancelled::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #dc2626;
}
.cal-day--proposed {
  background: #f3e8ff;
  color: #6b21a8;
  font-weight: 600;
  position: relative;
}
.cal-day--proposed::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c084fc;
}
.cal-day--today.cal-day--pending {
  background: #eab308;
  color: #fff;
}
.cal-day--today.cal-day--pending::after {
  background: #fff;
}
.cal-day--today.cal-day--confirmed {
  background: #15803d;
  color: #fff;
}
.cal-day--today.cal-day--confirmed::after {
  background: #fff;
}
.cal-day--today.cal-day--cancelled {
  background: #dc2626;
  color: #fff;
}
.cal-day--today.cal-day--cancelled::after {
  background: #fff;
}
.cal-day--today.cal-day--proposed {
  background: #9333ea;
  color: #fff;
}
.cal-day--today.cal-day--proposed::after {
  background: #fff;
}
.cal-day--clickable {
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.cal-day--clickable:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  z-index: 1;
  position: relative;
}

/* ===== Calendar Legend ===== */
.calendar-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  font-size: .8125rem;
}
.calendar-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-600);
}
.calendar-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-legend__dot--pending { background: #ca8a04; }
.calendar-legend__dot--confirmed { background: #16a34a; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .header__inner { gap: 12px; }
  .nav { gap: 12px; }
  .specialist-card { flex-direction: column; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }
}

/* ————— Dropdown ————— */
.dropdown { position: relative; display: inline-block; }
.dropdown-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  background: #fff;
  color: var(--gray-700);
  transition: border-color .15s, background .15s;
}
.dropdown-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37,99,235,.05);
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--gray-700);
  font-size: .9375rem;
  transition: background .1s;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--gray-100);
  color: var(--primary);
  text-decoration: none;
}
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 0; }
