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

/* ========================================
   BASE FORM
   ======================================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.form textarea {
  resize: vertical;
  min-height: 80px;
}

/* ========================================
   FORM GROUP
   ======================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e293b;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94a3b8;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* ========================================
   FORM GRID
   ======================================== */

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

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.form-grid textarea {
  resize: vertical;
  min-height: 80px;
}

.form-grid button {
  height: fit-content;
}

.form-grid input[type="file"] {
  padding: 0.5rem;
  border: 2px dashed #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
}

.form-grid input[type="file"]:hover {
  border-color: var(--primary, #8b5cf6);
}

/* ========================================
   FORM ROW
   ======================================== */

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

/* ========================================
   DURATION INPUT GROUP
   ======================================== */

.form-group-duration {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group-duration label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.duration-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.duration-input-group input {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  width: 80px;
  text-align: center;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.duration-input-group input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ========================================
   AUTH FORM
   ======================================== */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  max-width: 420px;
  width: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.auth-header {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  padding: 2rem;
  text-align: center;
  color: #fff;
}

.auth-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 800;
}

.auth-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.auth-body {
  padding: 1.5rem;
}

.auth-tabs {
  display: flex;
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: #fff;
  color: var(--primary, #8b5cf6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-auth {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-auth.primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
}

.btn-auth.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

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

.btn-auth.loading {
  opacity: 0.7;
  pointer-events: none;
}

.vkid-btn {
  width: 100%;
  padding: 0.875rem;
  background: #0077FF;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
  margin-top: 0.75rem;
}

.vkid-btn:hover {
  background: #0066DD;
  transform: translateY(-1px);
}

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

.or-divider {
  text-align: center;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-size: 0.9rem;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e2e8f0;
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

.form-consent-group {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 10px;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
}

.consent-item:last-child {
  margin-bottom: 0;
}

.consent-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary, #8b5cf6);
  cursor: pointer;
}

.consent-item span {
  line-height: 1.4;
}

.consent-item span a {
  color: var(--primary, #8b5cf6);
  text-decoration: underline;
}

.consent-item input[type="checkbox"]:invalid:not(:checked) + span {
  color: #dc2626;
}

/* ========================================
   REVIEW FORM
   ======================================== */

.review-form {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.star-rating {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.star-rating .star {
  font-size: 2rem;
  cursor: pointer;
  color: #e2e8f0;
  transition: color 0.2s, transform 0.2s;
}

.star-rating .star:hover,
.star-rating .star.active {
  color: #f59e0b;
  transform: scale(1.1);
}

.review-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.review-textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ========================================
   PROFILE FIELD
   ======================================== */

.profile-field {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.profile-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.profile-field input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.profile-field input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ========================================
   PROFILE FORM COMPACT
   ======================================== */

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

.profile-field-editable {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-field-editable label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.profile-field-editable input {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.profile-field-editable input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.profile-field-editable input::placeholder {
  color: #94a3b8;
}

/* ========================================
   PROFILE ABOUT FORM
   ======================================== */

.profile-about-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.profile-about-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.profile-about-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-about-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.profile-about-field input,
.profile-about-field textarea {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.profile-about-field input:focus,
.profile-about-field textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.profile-about-field input::placeholder,
.profile-about-field textarea::placeholder {
  color: #94a3b8;
}

/* ========================================
   SLUG INPUT
   ======================================== */

.slug-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.slug-input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.slug-input::placeholder {
  color: #94a3b8;
}

.slug-card {
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  border: 2px solid #e9d5ff;
  border-radius: 12px;
  padding: 1rem;
}

/* ========================================
   CHECKBOX & SWITCH LABELS
   ======================================== */

.checkbox-label,
.switch-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #475569;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"],
.switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #8b5cf6);
  cursor: pointer;
}

/* ========================================
   BUTTON BLOCK
   ======================================== */

.btn-block {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

/* ========================================
   APPOINTMENT COMMENT INPUT
   ======================================== */

.appt-comment-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  resize: vertical;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.appt-comment-input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========================================
   GUEST INPUT
   ======================================== */

.guest-input {
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  width: 100%;
}

.guest-input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

/* ========================================
   VKID BUTTON HIDDEN
   ======================================== */

.vkid-btn-hidden {
  display: none;
}

/* ========================================
   TOAST CONTAINER
   ======================================== */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guest-input.error {
  border-color: #ef4444;
}

/* ========================================
   SEARCH & FILTER INPUTS
   ======================================== */

.search-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.filter-select {
  padding: 0.85rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

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

@media (max-width: 768px) {
  /* iOS zoom prevention */
  input,
  select,
  textarea,
  .form input,
  .form select,
  .form textarea,
  .form-group input,
  .form-group select,
  .form-group textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .cabinet-section input,
  .cabinet-section select,
  .cabinet-section textarea,
  .auth-card input,
  .auth-card select,
  .profile-field-editable input,
  .search-input,
  .filter-select {
    font-size: 16px !important;
  }

  /* Forms full width */
  .form {
    max-width: 100%;
  }

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

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

  /* Star rating smaller */
  .star-rating .star {
    font-size: 1.75rem;
  }

  /* Auth card full screen on small devices */
  .auth-wrapper {
    padding: 0;
    align-items: flex-start;
  }

  .auth-card {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
  }
}

@media (max-width: 480px) {
  .auth-wrapper {
    padding: 0;
  }

  .auth-card {
    border-radius: 0;
    min-height: 100vh;
  }
}
