/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease),
              opacity var(--duration-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: #b85d7a;
}

.btn-secondary {
  background: var(--color-soft);
  color: var(--color-dark);
}

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

.btn-ghost {
  background: transparent;
  color: var(--color-dark);
}

.btn-ghost:hover {
  background: var(--color-soft);
}

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

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

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--font-size-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-fab {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 1.5rem;
  font-weight: 300;
}

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-xs);
  padding: var(--space-4);
}

.card-soft {
  background: var(--color-soft);
  border: none;
  box-shadow: none;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-muted { background: var(--color-border-soft); color: var(--color-muted); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-soft);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-xs); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--font-size-lg); }

/* Toast */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  background: var(--color-dark);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: toast-in var(--duration-base) var(--ease);
  pointer-events: auto;
}

.toast-error {
  background: var(--color-danger);
}

.toast-success {
  background: var(--color-success);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Overlay + Modal / Bottom sheet */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(41, 33, 38, 0.4);
  z-index: var(--z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease), visibility var(--duration-base);
}

.overlay.open {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  background: var(--color-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  max-height: min(92dvh, 92vh);
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-sheet);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-2);
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border-soft);
  flex-shrink: 0;
}

.sheet-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.sheet-body {
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.sheet-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border-soft);
  flex-shrink: 0;
  display: flex;
  gap: var(--space-3);
}

/* Desktop modal */
@media (min-width: 768px) {
  .bottom-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(480px, calc(100% - 48px));
    max-height: min(85vh, 720px);
    border-radius: var(--radius-xl);
    transform: translate(-50%, -48%) scale(0.96);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--duration-slow) var(--ease),
                opacity var(--duration-slow) var(--ease),
                visibility var(--duration-slow);
  }
  .bottom-sheet.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
  }
  .sheet-handle {
    display: none;
  }
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-soft) 25%, var(--color-soft) 50%, var(--color-border-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 72px;
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--color-muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  opacity: 0.7;
}

.empty-state-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-dark);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-5);
}

/* Booking card */
.booking-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-soft);
  margin-bottom: var(--space-2);
  transition: border-color var(--duration-fast);
  cursor: pointer;
}

.booking-card:active {
  border-color: var(--color-primary);
}

.booking-time {
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.booking-time-start {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--color-dark);
}

.booking-time-end {
  font-size: var(--font-size-xs);
  color: var(--color-muted);
}

.booking-body {
  flex: 1;
  min-width: 0;
}

.booking-client {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.booking-service {
  font-size: var(--font-size-sm);
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.booking-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 4px;
  flex-wrap: wrap;
}

.booking-price {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

/* Client row */
.client-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-soft);
  cursor: pointer;
}

.client-row:last-child {
  border-bottom: none;
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-sub {
  font-size: var(--font-size-sm);
  color: var(--color-muted);
}

.client-stats {
  text-align: right;
  flex-shrink: 0;
}

/* Search */
.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4) 0 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--duration-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
}

/* Confirm dialog */
.confirm-dialog {
  text-align: center;
  padding: var(--space-4) 0;
}

.confirm-dialog p {
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: var(--font-size-sm);
}

.confirm-dialog strong {
  color: var(--color-dark);
  font-size: var(--font-size-md);
}
