/*
*   Styles for AutomaticFFL Checkout
*/

.dealers-container {
  width: 70%;
  height: 70%;
  background-color: #ffffff;
  border-radius: 6px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  display: block;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

#automaticffl-map-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.automaticffl-dealer-layer {
  width: 100%;
  z-index: 1000;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #000;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease-out, visibility 200ms ease-out;
}

.automaticffl-dealer-layer.visible {
  opacity: 1;
  visibility: visible;
}

.automaticffl-dealer-selected {
  border: solid 2px #522a74;
  padding: 20px 20px 0px 20px;
  margin-bottom: 2.617924em;
  border-left: 0.6180469716em solid #522a74;
  color: #333333;
  border-radius: 2px;
}

.automaticffl-dealer-selected a {
  color: #333333;
}

/* Hide templates and hidden fields */
#automaticffl-dealer-card-template,
.hidden {
  display: none;
}

.dealer-phone {
  color: #512a74;
  margin: 0;
}
@media screen and (max-width: 800px) {
  .dealers-container {
    width: 96%;
    height: 90%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    border-radius: 6px;
  }
  .automaticffl-dealer-layer {
    z-index: 10000;
  }
}

#automaticffl-select-dealer {
  margin-bottom: 15px;
}

#automaticffl-select-dealer svg {
  display: inline-block;
  vertical-align: middle;
}

/* FFL-298 this prevents the scroll bar from taking up space inside the html */
body {
  margin-right: calc(-1 * (100vw - 100%)) !important;
}

/*
 * Block Checkout Styles - FFL Dealer Selection
 */

/* Hide shipping address form when FFL checkout is active */
body.automaticffl-checkout-active .wp-block-woocommerce-checkout-shipping-address-block,
body.automaticffl-checkout-active .wc-block-checkout__shipping-fields {
  display: none !important;
}

/* Hide the "Use same address for billing" checkbox when FFL checkout is active */
body.automaticffl-checkout-active .wc-block-checkout__use-address-for-billing {
  display: none !important;
}

/* Ensure billing address form is always visible when FFL checkout is active */
body.automaticffl-checkout-active .wp-block-woocommerce-checkout-billing-address-block,
body.automaticffl-checkout-active .wc-block-checkout__billing-fields {
  display: block !important;
}

/* FFL Dealer Selection component styling for blocks checkout */
.automaticffl-dealer-selection {
  margin-bottom: 1.5em;
}

.automaticffl-dealer-selection .wc-block-components-notice-banner {
  margin-bottom: 1em;
}

/* Find/Change Dealer button styling */
.automaticffl-dealer-selection .ffl-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #333333;
  color: #ffffff;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 200ms ease;
}

.automaticffl-dealer-selection .ffl-search-button:hover {
  background-color: #444444;
}

.automaticffl-dealer-selection .ffl-search-button svg {
  flex-shrink: 0;
}

/* Selected dealer card for blocks checkout */
.automaticffl-dealer-selection .automaticffl-dealer-selected {
  margin-bottom: 1em;
}

/*
 * State Selector Styles - Ammo Checkout
 */

/* Classic checkout state selector */
#automaticffl-ammo-checkout {
  margin-bottom: 2em;
}

#automaticffl-ammo-checkout h3 {
  margin-bottom: 1em;
}

#automaticffl-state-selector {
  width: 100%;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff;
}

#automaticffl-state-selector:focus {
  border-color: #522a74;
  outline: none;
  box-shadow: 0 0 0 2px rgba(82, 42, 116, 0.2);
}

#automaticffl-state-message {
  margin-top: 15px;
  margin-bottom: 15px;
}

.automaticffl-state-restricted .woocommerce-error,
.automaticffl-state-allowed .woocommerce-message {
  margin-bottom: 0;
}

#automaticffl-ffl-container {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

/* Block checkout state selector */
.automaticffl-state-selector {
  margin-bottom: 1.5em;
}

.automaticffl-state-selector h3 {
  margin-bottom: 0.75em;
  font-size: 1.1em;
}

.automaticffl-state-select-wrapper {
  margin: 1em 0;
}

.automaticffl-state-select-wrapper label {
  display: block;
  margin-bottom: 0.5em;
  font-weight: 500;
}

.automaticffl-state-select-wrapper select {
  width: 100%;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff;
}

.automaticffl-state-select-wrapper select:focus {
  border-color: #522a74;
  outline: none;
  box-shadow: 0 0 0 2px rgba(82, 42, 116, 0.2);
}

.automaticffl-state-message {
  margin-top: 1em;
}

/* Success notice styling for blocks */
.wc-block-components-notice-banner.is-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.wc-block-components-notice-banner.is-success svg {
  fill: #28a745;
}

/* Warning notice styling for blocks */
.wc-block-components-notice-banner.is-warning {
  background-color: #fff3cd;
  border-color: #ffc107;
}

.wc-block-components-notice-banner.is-warning svg {
  fill: #856404;
}

/* Ammo checkout container in block checkout */
.automaticffl-dealer-selection .automaticffl-state-selector {
  margin-bottom: 1.5em;
  padding-bottom: 1em;
  border-bottom: 1px solid #e0e0e0;
}

/*
 * API Unavailable Notice Styles
 */

.automaticffl-unavailable-notice {
  margin-bottom: 1.5em;
}

.automaticffl-unavailable-message {
  text-align: center;
}

.automaticffl-unavailable-message p {
  margin: 0 0 0.5em 0;
}

.automaticffl-unavailable-message p:last-of-type {
  margin-bottom: 1em;
}

.automaticffl-unavailable-message button {
  margin-top: 0.5em;
}

/* Classic checkout unavailable notice */
#automaticffl-unavailable-notice .woocommerce-info {
  text-align: center;
  padding: 20px;
}

#automaticffl-unavailable-notice .woocommerce-info p {
  margin: 0 0 0.5em 0;
}

#automaticffl-unavailable-notice .woocommerce-info button {
  margin-top: 10px;
}

/*
 * Ammo-Only Checkout - Shipping Form Visibility Transitions
 */

/* Classic checkout shipping form transitions */
.woocommerce-shipping-fields,
#ship-to-different-address,
.woocommerce-shipping-fields__field-wrapper {
  transition: opacity 0.15s ease-in-out;
}

/* Block checkout shipping form transitions */
.wp-block-woocommerce-checkout-shipping-address-block,
.wc-block-checkout__shipping-fields {
  transition: opacity 0.15s ease-in-out;
}

/*
 * Standardized Notice Banners - Cart Page
 * Used for both firearms and ammo mixed cart notices
 */

/* Base notice styles */
.automaticffl-notice {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  margin-bottom: 2em;
  padding: 1em 1.5em;
  border-radius: 4px;
  background: #f9f9f9;
  color: #515151;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Checkout ammo+regular notice: hidden by default, shown via JS class toggle */
#automaticffl-ammo-regular-message {
  display: none !important;
}

#automaticffl-ammo-regular-message.is-visible {
  display: flex !important;
}

/* Notice icon */
.automaticffl-notice-icon {
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.automaticffl-notice-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

/* Notice content */
.automaticffl-notice-content {
  flex: 1 1 auto !important;
  min-width: 0;
}

/* Notice message */
.automaticffl-notice-message {
  margin: 0 0 0.5em 0;
  padding: 0;
  font-weight: 600;
  color: #515151;
}

/* Error state */
.automaticffl-notice-error {
  border-top: 3px solid #b81c23;
}

.automaticffl-notice-error .automaticffl-notice-icon {
  color: #b81c23;
}

/* Success state */
.automaticffl-notice-success {
  border-top: 3px solid #4a7c0f;
}

.automaticffl-notice-success .automaticffl-notice-icon {
  color: #4a7c0f;
}

/* Info state */
.automaticffl-notice-info {
  border-top: 3px solid #1e85be;
}

.automaticffl-notice-info .automaticffl-notice-icon {
  color: #1e85be;
}

.automaticffl-state-row {
  margin-bottom: 15px;
}

.automaticffl-state-row label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.automaticffl-state-row abbr.required {
  text-decoration: none;
  border: none;
  color: #b81c23;
  cursor: default;
}

#automaticffl-cart-state-select {
  width: 100%;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff;
}

#automaticffl-cart-state-select:focus {
  border-color: #522a74;
  outline: none;
  box-shadow: 0 0 0 2px rgba(82, 42, 116, 0.2);
}

/* Ammo + Regular allowed state styling for blocks */
.automaticffl-ammo-regular-allowed {
  margin-bottom: 1.5em;
}

/*
 * Save for Later - Mixed Cart Feature
 */

/* Save for later section within notice */
.automaticffl-notice .automaticffl-save-prompt {
  margin: 0.75em 0 0.5em 0;
  padding-top: 0.75em;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 500;
  font-size: 14px;
  color: #515151;
}

.automaticffl-save-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
}

/* Primary button (FFL items) */
.automaticffl-notice .automaticffl-save-btn {
  flex: 1;
  max-width: 220px;
  min-width: auto;
  padding: 10px 20px;
  background-color: #b81c23;
  color: #ffffff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  text-align: center;
  transition: background-color 150ms ease;
}

.automaticffl-notice .automaticffl-save-btn:hover {
  background-color: #961720;
  color: #ffffff;
}

.automaticffl-notice .automaticffl-save-btn:focus {
  outline: 2px solid #522a74;
  outline-offset: 2px;
}

/* Secondary button (Regular items) */
.automaticffl-notice .automaticffl-save-btn[data-item-type="regular"] {
  background-color: #f7f6f7;
  color: #515151;
  border: 1px solid #ccc;
}

.automaticffl-notice .automaticffl-save-btn[data-item-type="regular"]:hover {
  background-color: #eee;
  border-color: #999;
  color: #515151;
}

.automaticffl-notice .automaticffl-save-btn:disabled,
.automaticffl-notice .automaticffl-save-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Helper text for save for later */
.automaticffl-notice .automaticffl-save-help {
  margin: 0.75em 0 0 0;
  padding: 0;
  font-size: 13px;
  color: #666;
  font-style: italic;
}

/* Error message for save failures */
#automaticffl-save-error {
  margin-bottom: 10px;
}

/* Thank you page redirect notice */
.automaticffl-redirect-notice.automaticffl-notice {
  margin-bottom: 2em;
}

.automaticffl-countdown {
  font-weight: bold;
  font-size: 1.1em;
  color: #1e85be;
  margin: 0 3px;
}

.automaticffl-redirect-action {
  margin: 0.75em 0 0 0;
}

.automaticffl-redirect-action .button {
  display: inline-block;
  background-color: #333333;
  color: #ffffff;
  padding: 10px 20px;
  border: none;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.automaticffl-redirect-action .button:hover {
  background-color: #444444;
  color: #ffffff;
}

/* Responsive adjustments */
@media screen and (max-width: 600px) {
  .automaticffl-save-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

  .automaticffl-save-btn {
    width: 100%;
  }
}

/*
 * Blocks Checkout - Save for Later
 */

.automaticffl-blocks-save-for-later {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.automaticffl-blocks-save-prompt {
  margin-bottom: 12px;
  font-weight: 500;
}

.automaticffl-blocks-save-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.automaticffl-blocks-save-btn {
  flex: 1;
  min-width: 180px;
}

/* Primary button (FFL items) - uses default dark style */
.automaticffl-blocks-save-btn--primary {
  background-color: #333333;
  color: #ffffff;
}

.automaticffl-blocks-save-btn--primary:hover {
  background-color: #444444;
  color: #ffffff;
}

/* Secondary button (Regular items) - lighter style */
.automaticffl-blocks-save-btn--secondary {
  background-color: #f7f6f7;
  color: #515151;
  border: 1px solid #ccc;
}

.automaticffl-blocks-save-btn--secondary:hover {
  background-color: #eee;
  border-color: #999;
  color: #515151;
}

.automaticffl-blocks-save-help {
  margin: 0;
  font-size: 13px;
  color: #666;
  font-style: italic;
}

