/* Mobile UX enhancements based on IMPLEMENTATION-GUIDE.md */

@media (max-width: 768px) {
  .tenant-mobile-shell .locale-switcher-shell {
    display: none;
  }

  .tenant-mobile-shell header {
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .tenant-mobile-shell header.scrolled > div {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .tenant-mobile-shell header.scrolled a.font-display {
    font-size: 1rem;
  }

  .tenant-mobile-shell header nav.top-nav-scroll {
    display: none;
  }

  .tenant-mobile-shell main {
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.08);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .mobile-nav-item {
    position: relative;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.65rem 0.3rem;
    text-decoration: none;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item:active {
    transform: scale(0.96);
  }

  .mobile-nav-item.active {
    color: #d97706;
  }

  .mobile-nav-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: #d97706;
  }

  .mobile-nav-icon {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    min-height: 48px !important;
    font-size: 16px !important;
    -webkit-appearance: none;
    appearance: none;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1) !important;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
  }

  .touch-target,
  button.touch-target,
  a.touch-target {
    min-height: 48px !important;
  }

  .touch-target:active {
    transform: scale(0.98);
  }
}

@media (max-width: 768px) {
  .appointments-mobile-fab {
    bottom: calc(5rem + env(safe-area-inset-bottom));
    min-height: 56px;
    min-width: 56px;
  }

  .appointments-mobile-fab.hide-on-scroll {
    transform: translateY(calc(100% + 2rem));
  }
}

.toast-container {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(5.3rem + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateY(calc(100% + 1rem));
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
}

.toast-success {
  background: rgba(22, 163, 74, 0.95);
}

.toast-error {
  background: rgba(239, 68, 68, 0.95);
}

.toast-warning {
  background: rgba(245, 158, 11, 0.95);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.search-wrapper {
  position: relative;
}

.search-wrapper input {
  padding-right: 2.9rem;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9999px;
  background: #cbd5e1;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-wrapper.has-value .search-clear {
  display: flex;
}

.input-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 500;
}

.error-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
