/* 
 * Xi Woo Cart Forms
 * 
 * Form styles for:
 * - Input fields
 * - Checkboxes
 * - Field wrappers
 * - Validation states
 * - Autocomplete
 */

/* ==========================================================================
   Form Field Wrapper
   ========================================================================== */

   .field-wrapper {
    position: relative;
    margin-bottom: 15px;
    margin-left: 10px;
  }
  
  .field-wrapper.has-error input {
    border-color: #dc3545 !important;
    background-color: #fff8f8 !important;
  }
  
  .field-wrapper.has-error input:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
  }
  
  .field-wrapper label {
    text-align: right;
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
  }
  
  /* ==========================================================================
       Input Fields
       ========================================================================== */
  
  /* Common input styling */
  .field-wrapper input,
  .checkout-form input[type="text"],
  .checkout-form input[type="number"],
  .checkout-form input[type="tel"],
  .checkout-form input[type="email"],
  .checkout-form textarea {
    width: 100% !important;
    padding: 10px 15px !important;
    border: 1px solid #ddd !important;
    border-radius: 20px !important;
    font-size: 1rem !important;
    transition: border-color 0.2s ease;
    background-color: white;
  }
  
  .field-wrapper input:focus,
  .checkout-form input:focus,
  .checkout-form textarea:focus {
    border-color: #003768 !important;
    outline: none;
    box-shadow: 0 0 3px rgba(0, 55, 104, 0.2);
  }
  
  /* Specific field size overrides */
  .woocommerce form input[type="number"] {
    max-width: 100% !important;
  }
  
  /* Textarea specific styles */
  .checkout-form textarea {
    min-height: 100px;
    resize: vertical;
  }
  
  /* Disabled state styling */
  .field-wrapper input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
  }
  
  /* ==========================================================================
       Basic Checkbox Styling
       ========================================================================== */
  
  /* Standard checkbox container */
  .checkbox-container {
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
  }
  
  /* Regular standard checkbox */
  input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    vertical-align: middle;
    border: 1px solid #aaa !important;
    border-radius: 2px !important;
    background-color: white !important;
    cursor: pointer;
    /* Keep original display property */
    display: inline-block;
  }
  
  /* Checkbox label text, to keep inline with checkbox */
  .terms-mail-approve {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    font-size: 1.2rem;
  }
  
  /* ==========================================================================
       Consent Section Advanced Checkbox Styling
       ========================================================================== */
  
  /* /////////////////////////////////////////// */
  /* Complete checkbox reset and styling for consent section specifically */
  
  /* Reset all checkbox styling first in consent section */
  .consent-section input[type="checkbox"] {
    /* Remove all browser styling completely */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Reset all properties */
    background: none;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    /* Prevent browser from adding any visuals */
    outline: none !important;
  }
  
  /* Basic layout for the consent section */
  .consent-section .field-wrapper {
    margin-bottom: 15px;
  }
  
  /* Flex layout for label */
  .consent-section .checkbox-label {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 8px;
  }
  
  /* Style the checkbox container */
  .consent-section .checkbox-container {
    position: relative;
    width: 14px;
    height: 14px;
    margin-top: 3px;
    display: block; /* Override for consent section */
    margin-left: 0; /* Override for consent section */
  }
  
  /* Custom checkbox styling */
  .consent-section .checkbox-label input[type="checkbox"] {
    /* Fixed size for the checkbox */
    width: 14px;
    height: 14px;
    /* Custom appearance */
    border: 1px solid #aaa;
    border-radius: 2px;
    background-color: white;
    cursor: pointer;
    display: block;
    position: relative;
    /* Prevent any automatic browser styling */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }
  
  /* Custom checkmark */
  .consent-section .checkbox-label input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #0073aa;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    background: none;
  }
  
  /* Make sure no browser checkmark appears */
  .consent-section .checkbox-label input[type="checkbox"]:checked::before {
    content: none !important;
    display: none !important;
  }
  
  /* Style the label text */
  .consent-section .checkbox-label .terms-mail-approve {
    flex: 1;
    text-align: right;
    font-size: 14px;
    line-height: 1.4;
    margin-right: 0; /* Override for consent section */
    display: block; /* Override for consent section */
  }
  
  /* Style error messages */
  .consent-section .error-message {
    margin-top: 5px;
    padding-right: 22px; /* Align with text */
    color: #e2401c;
    font-size: 12px;
    display: none;
  }
  
  .consent-section .field-wrapper.has-error .error-message {
    display: block;
  }
  
  /* ==========================================================================
       Coupon Section
       ========================================================================== */
  
  .xi-coupon-section {
    margin-bottom: 20px;
  }
  
  .xi-coupon-section .coupon {
    display: flex;
    gap: 10px;
  }
  
  .xi-coupon-section input[type="text"] {
    flex: 1;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
  }
  
  /* ==========================================================================
       Form Layout for Checkout
       ========================================================================== */
  
  /* Table-based layout for both Personal Info and Shipping forms */
  .personal-info-table,
  .shipping-info-table {
    width: 100%;
    border-spacing: 10px;
  }
  
  .personal-info-table td,
  .shipping-info-table td {
    border: none;
    width: 50%;
    vertical-align: top;
  }
  
  /* Common Form Styles */
  .checkout-form {
    width: 100%;
  }
  
  /* ==========================================================================
       Autocomplete Styling
       ========================================================================== */
  
  /* Autocomplete dropdown styling */
  .ui-autocomplete {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    padding: 4px 0;
    direction: rtl;
    text-align: right;
    z-index: 9999 !important;
  }
  
  /* Scrollbar styling */
  .ui-autocomplete::-webkit-scrollbar {
    width: 8px;
  }
  
  .ui-autocomplete::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }
  
  .ui-autocomplete::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
  }
  
  .ui-autocomplete::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
  
  /* Individual item styling */
  .ui-menu .ui-menu-item {
    padding: 0;
    margin: 0;
  }
  
  .ui-menu .ui-menu-item div {
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  /* Hover and focus states */
  .ui-menu .ui-menu-item div.ui-state-active,
  .ui-menu .ui-menu-item div:hover {
    background-color: #f5f8ff;
    color: #4a90e2;
    border: none;
    margin: 0;
  }
  
  /* No results styling */
  .ui-autocomplete .ui-menu-item.ui-state-disabled {
    padding: 10px 16px;
    color: #999;
    font-style: italic;
  }
  
  /* ==========================================================================
     Forms (Mobile)
     ========================================================================== */
  
  @media (max-width: 768px) {
    table {
      margin-bottom: 0.2rem;
    }
  
    label {
      font-size: 1rem;
    }
  }

/* ==========================================================================
   Shipping Method Select
   ========================================================================== */

.xi-shipping-methods {
  margin: 15px 10px 20px;
}

.xi-shipping-methods label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  text-align: right;
}

#xi-shipping-method {
  width: 100% !important;
  padding: 10px 40px 10px 15px !important; /* space for RTL arrow on right */
  border: 1px solid #ddd !important;
  border-radius: 20px !important;
  font-size: 1rem !important;
  background-color: #fff !important;
  color: #0C2633 !important;
  direction: rtl;
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230C2633' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center; /* RTL: arrow on right */
}

#xi-shipping-method:focus {
  border-color: #0C2633 !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(12, 38, 51, 0.12);
}

#xi-shipping-method option {
  color: #0C2633;
}

@media (max-width: 768px) {
  .xi-shipping-methods {
    margin: 10px 0 15px;
  }
}
  