/* ============================================
   CARD & GRID SYSTEM - GraceMe
   Единый источник правды для карточек и сеток
   ============================================ */

/* ========================================
   BASE CARD
   ======================================== */

.card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.3s ease;
}

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

/* ========================================
   MASTER CARD (landing page)
   ======================================== */

.master-card {
  background: var(--surface, #fff);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 2px solid transparent;
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.master-card:hover {
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12);
  transform: translateY(-4px);
  border-color: #ede9fe;
}

/* Master card banner */
.master-card-banner {
  width: 100%;
  height: 100px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ede9fe 0%, #f5f0f5 100%);
}

.master-card-banner img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

/* Ensure badges are positioned relative to banner */
.master-card-banner .popular-badge,
.master-card-banner .master-card-name-badge {
  position: absolute;
  z-index: 10;
}

/* Fallback banner - same height as image banner */
.master-card-fallback-banner {
  width: 100%;
  height: 100px;
  background: linear-gradient(135deg, #ede9fe 0%, #f5f0f5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.master-card-fallback-banner .master-avatar-small {
  position: static;
  transform: none;
  width: 64px;
  height: 64px;
  font-size: 1.8rem;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 50%;
}

/* Master card body */
.master-card-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Ensure consistent card height */
.master-card-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.25rem 0;
  word-break: break-word;
  line-height: 1.3;
}

.master-card-body p {
  color: #64748b;
  margin: 0.15rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Master card CTA */
.master-card-cta {
  margin-top: auto !important;
  padding: 0.6rem 1.25rem !important;
  font-size: 0.9rem !important;
  border-radius: 10px !important;
  min-height: 38px !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100% !important;
}

/* Ensure consistent card heights */
.master-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Popular badge */
.popular-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
  animation: popularPulse 2s ease-in-out infinite;
  z-index: 11;
  line-height: 1.2;
  white-space: nowrap;
}

@keyframes popularPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3); }
  50% { box-shadow: 0 2px 16px rgba(251, 191, 36, 0.5); }
}

/* Specialty tag */
.master-specialty-tag {
  display: inline-block;
  background: linear-gradient(135deg, #ede9fe, #f5f0f5);
  color: var(--primary-dark, #7c3aed);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  margin: 0.25rem 0;
}

/* Skills */
.master-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.25rem 0;
}

.master-skills span {
  background: var(--bg, #f8fafc);
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
}

/* Master bio */
.master-bio {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin: 0.25rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Master city */
.master-city {
  margin: 0.15rem 0;
}

/* ====== MASTER RATING ====== */
.master-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.rating-stars {
  color: #fbbf24;
  font-size: 1rem;
  letter-spacing: 1px;
}

.rating-value {
  font-weight: 700;
  color: #1e293b;
  font-size: 1rem;
}

.rating-count {
  color: #64748b;
  font-size: 0.85rem;
}

/* Master card name badge */
.master-card-name-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(255, 255, 255, 0.97);
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  z-index: 11;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.1);
}

/* ========================================
   SKELETON LOADING
   ======================================== */

.master-card-skeleton {
  pointer-events: none;
}

.skeleton-banner {
  width: 100%;
  height: 100px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-name { width: 70%; height: 20px; }
.skeleton-rating { width: 40%; }
.skeleton-city { width: 60%; }
.skeleton-spec { width: 50%; }
.skeleton-bio { width: 100%; height: 10px; }
.skeleton-btn { width: 40%; height: 44px; border-radius: 12px; margin-top: 0.5rem; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========================================
   APPOINTMENT CARD (cabinet)
   ======================================== */

.appointment-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 1rem;
  border: 2px solid #e2e8f0;
  transition: border-color 0.2s;
}

.appointment-card:hover {
  border-color: #cbd5e1;
}

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

.appointment-service {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}

.appointment-status {
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.appointment-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.appointment-status.confirmed {
  background: #d1fae5;
  color: #065f46;
}

.appointment-status.completed {
  background: #dbeafe;
  color: #1e40af;
}

.appointment-status.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Mobile appointment card (cabinet-master) */
.appt-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.appt-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.appt-card[data-status="pending"]::before { background: #f59e0b; }
.appt-card[data-status="confirmed"]::before { background: #22c55e; }
.appt-card[data-status="completed"]::before { background: #3b82f6; }
.appt-card[data-status="cancelled"]::before { background: #ef4444; }

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

.appt-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.appt-card-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.appt-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========================================
   STAT CARD
   ======================================== */

.stat-card {
  background: #fff;
  padding: 1.25rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-card-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
  border: none;
}

.stat-card-secondary {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.stat-card-primary .stat-value {
  color: #fff;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.stat-card-primary .stat-label {
  color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   SERVICE CARD (cabinet)
   ======================================== */

.service-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.service-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ========================================
   SLOT CARD (cabinet)
   ======================================== */

.slot-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.slot-card:hover {
  border-color: #8b5cf6;
  background: #faf5ff;
}

.slot-card.active {
  border-color: #8b5cf6;
  background: #ede9fe;
}

/* ========================================
   PORTFOLIO ITEM
   ======================================== */

.portfolio-item {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

.portfolio-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.portfolio-item-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.portfolio-item-badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

.portfolio-item-category {
  position: absolute;
  top: 12px;
  left: 12px;
}

.portfolio-item-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
}

.portfolio-item-content {
  padding: 1.25rem;
}

.portfolio-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

/* ========================================
   PERIOD STAT CARD
   ======================================== */

.period-stat-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

/* ========================================
   SLOTS CARDS
   ======================================== */

.slots-main-card {
  border: 2px solid #8b5cf6;
  background: linear-gradient(135deg, #faf5ff, #fff);
  border-radius: 12px;
  padding: 1.25rem;
}

.slots-sub-card {
  padding: 1.25rem;
  background: #f8fafc;
  border-radius: 12px;
}

/* ========================================
   GENERIC GRIDS
   ======================================== */

.grid {
  display: grid;
  gap: 1rem;
}

.masters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.client-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ========================================
   FORM ROWS
   ======================================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Cards full width */
  .card,
  .master-card,
  .service-card,
  .appointment-card,
  .profile-card,
  .stat-card {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Grids single column */
  .grid,
  .masters-grid,
  .services-grid,
  .stats-grid,
  .quick-actions-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Slots grid 2 columns */
  .slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Portfolio grid */
  .portfolio-grid,
  .client-portfolio-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  /* Form rows single column */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Appointment details 2 columns */
  .appointment-details {
    grid-template-columns: 1fr 1fr;
  }

  /* Master card body */
  .master-card-body h3 {
    font-size: 1.05rem;
  }

  .master-card-body p {
    font-size: 0.85rem;
  }

  .master-card-body .btn {
    width: 100%;
    text-align: center;
  }

  /* Stat cards */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  /* Extra compact cards */
  .card,
  .master-card {
    padding: 0.875rem;
    margin-bottom: 0.75rem;
  }

  /* Grids single column */
  .stats-grid,
  .quick-actions-grid,
  .slots-grid {
    grid-template-columns: 1fr;
  }

  /* Portfolio single column */
  .portfolio-grid,
  .client-portfolio-grid {
    grid-template-columns: 1fr;
  }

  /* Appointment details single column */
  .appointment-details {
    grid-template-columns: 1fr;
  }

  /* Appointment header column */
  .appointment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Master card body */
  .master-card-body h3 {
    font-size: 1rem;
  }
}

/* ========================================
   LANDING PAGE MASTERS GRID
   ======================================== */

.masters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ====== ANIMATIONS ====== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface, #fff);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
  border: 2px dashed var(--border, #e2e8f0);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}
