/*
 * form-base.css
 * GLOBAL — loaded via base.html for ALL pages.
 * Products app pages that inherit this:
 *   - add_product.html, add_category.html, add_subcategory.html
 *   - add_producttype.html, add_brand.html, add_size.html, add_size_category.html
 *   - product_detail.html (order form inputs)
 *
 * Base form styles: form frame, floating labels, inputs, icons, mobile field
 *
 * Used in:
 *   accounts/login.html
 *   accounts/register.html
 *   accounts/register_vendor.html
 *   accounts/register_supplier.html
 *   accounts/register_staff_admin.html
 */
:root {
  --primary-color: #0aad0a;
  --primary-green: #0aad0a;
  --primary-green-dark: #089408;
  --primary-green-light: rgba(10, 173, 10, 0.15);
  --primary-green-extra-light: rgba(10, 173, 10, 0.08);

  --text-dark: #1a1a1a;
  --text-dark-medium: #2d3748;
  --text-gray: #4a5568;
  --text-light: #718096;

  --border-color: #e2e8f0;
  --border-light: #edf2f7;

  --background-white: #ffffff;
  --background-light: #f7fafc;

  --accent-red: #dc3545;
  --accent-red-light: rgba(220, 53, 69, 0.1);

  --radius-lg: 12px;
  --radius-md: 8px;

  --space-xl: 1.5rem;
  --space-lg: 1rem;
  --space-md: 0.75rem;
  --space-sm: 0.5rem;
  --space-xs: 0.25rem;

  --font-bold: 700;
  --font-semibold: 600;
  --font-medium: 500;

  --font-lg: 1.125rem;
  --font-sm: 0.875rem;
  --font-xs: 0.75rem;
}

/* Dark mode variables */
[data-bs-theme="dark"] {
  --text-dark: #ffffff;
  --text-dark-medium: #ffffff;
  --text-gray: #ffffff;
  --text-light: #e5e7eb;

  --border-color: #2d3142;
  --border-light: #252834;

  --background-white: #1f2330;
  --background-light: #1a1d26;

  --accent-red-light: rgba(220, 53, 69, 0.2);
  --primary-green-light: rgba(10, 173, 10, 0.25);
  --primary-green-extra-light: rgba(10, 173, 10, 0.15);
}

/* Order Form Frame */
.order-form-frame {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--background-white);
  padding: var(--space-lg);
  margin-bottom: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.order-form-header {
  margin-bottom: var(--space-md);
  text-align: left;
  padding-bottom: var(--space-sm);
  border-bottom: 2px dashed var(--primary-green);
}

.order-form-header h5 {
  color: var(--primary-green);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-xs);
  font-size: var(--font-lg);
}

.order-form-frame .form-label {
  background: var(--background-white);
  color: var(--text-dark-medium);
  font-weight: var(--font-semibold);
  font-size: var(--font-xs);
  position: absolute;
  top: -0.6rem;
  left: 0.9rem;
  padding: 0 0.4rem;
  pointer-events: none;
  z-index: 1;
}

.order-form-frame .form-outline {
  position: relative;
  margin-bottom: var(--space-lg);
}

.order-form-frame .form-control {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  background-color: var(--background-white);
  font-size: var(--font-sm);
  width: 100%;
  color: var(--text-dark);
}

.order-form-frame .form-control:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px var(--primary-green-light);
  outline: none;
}

.order-form-frame .form-control.is-invalid,
.input-with-icon.is-invalid .form-control,
.mobile-number-input-field.is-invalid {
  border-color: var(--accent-red) !important;
  box-shadow: 0 0 0 3px var(--accent-red-light) !important;
}

/* Select2 invalid state */
.order-form-frame .form-control.is-invalid + .select2-container--bootstrap-5 .select2-selection {
  border-color: var(--accent-red) !important;
  box-shadow: 0 0 0 3px var(--accent-red-light) !important;
}

.field-error-message {
  color: var(--accent-red);
  font-size: var(--font-xs);
  margin-top: var(--space-xs);
  display: none;
  font-weight: var(--font-medium);
}

.field-error-message.show {
  display: block;
}

.order-form-frame .row {
  margin-left: 0;
  margin-right: 0;
}

.order-form-frame .row .col-6 {
  padding-left: 0;
  padding-right: var(--space-sm);
}

.order-form-frame .row .col-6:last-child {
  padding-right: 0;
  padding-left: var(--space-sm);
}

/* Mobile Number Input */
.mobile-number-input-field {
  display: flex;
  align-items: center;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--background-white);
  transition: all 0.3s ease;
  overflow: hidden;
}

.mobile-number-input-field:focus-within {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px var(--primary-green-light);
}

.country-code {
  background: var(--background-light);
  padding: var(--space-md);
  border-right: 1px solid var(--border-color);
  color: var(--text-gray);
  font-weight: var(--font-semibold);
  font-size: var(--font-sm);
  white-space: nowrap;
  display: flex;
  align-items: center;
  min-width: 60px;
  justify-content: center;
}

.mobile-input {
  border: none !important;
  box-shadow: none !important;
  flex: 1;
  padding: var(--space-md);
  font-size: var(--font-sm);
  background: transparent;
  color: var(--text-dark);
}

.mobile-helper-text {
  font-size: var(--font-xs);
  color: var(--text-light);
  margin-top: var(--space-xs);
  font-style: italic;
}

/* Input with Icon */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: #718096;
  font-size: 16px;
  z-index: 2;
  pointer-events: none;
  width: 16px;
  text-align: center;
}

.input-icon-right {
  position: absolute;
  right: 12px;
  color: #718096;
  font-size: 16px;
  z-index: 2;
  pointer-events: none;
  width: 16px;
  text-align: center;
}

.input-with-icon .form-control {
  padding-left: 45px !important;
}

.input-with-icon .input-icon-right ~ .form-control {
  padding-left: 12px !important;
  padding-right: 45px !important;
}

/* Form Buttons */
.form-buttons-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
}

.btn-action {
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 32px;
  text-decoration: none;
}

.btn-save, .btn-register {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: var(--background-white);
  border: 2px solid var(--primary-green);
}

.btn-save:hover, .btn-register:hover {
  background: linear-gradient(135deg, var(--primary-green-dark), #089408);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 173, 10, 0.3);
}

.btn-cancel {
  background: transparent;
  color: var(--text-gray);
  border: 2px solid var(--border-color);
}

.btn-cancel:hover {
  background: #f8f9fa;
  border-color: var(--text-gray);
  color: var(--text-dark);
}

/* Map Container */
.map-container {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--background-white);
  padding: var(--space-lg);
}

#map {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  margin-bottom: var(--space-md);
}

.btn-current-location {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-current-location:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Address Field Status */
.address-field-status-message {
  font-size: 10px;
  color: #6c757d;
  margin-top: 0.25rem;
  font-style: italic;
}
