@import url("https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap");

/* Lock Scrollbar when Modal is Open */
body.tgm-modal-open {
  overflow: hidden !important;
  padding-right: 0 !important;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 1000px;
  }

  to {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
  }
}

/* Container */
.tgm-address-book-container {
  margin-bottom: 20px;
  font-family: "Prompt", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

.tgm-checkbox-label {
  margin-top: 20px;
}

/* Selected Address Box */
.tgm-selected-address-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border: 1px solid #e5e5e5;
  background: #fff;
  margin: 0;
}

.tgm-selected-address-content {
  flex-grow: 1;
  font-size: 16px;
  line-height: 1.5;
  color: #231f20;
}

/* Tax type label for billing (บุคคลธรรมดา, นิติบุคคล) - small gray text on top */
.tgm-addr-tax-label {
  color: #999;
  font-size: 16px;
  margin-bottom: 4px;
}

/* Name + phone on same line */
.tgm-addr-name-phone {
  font-weight: 600;
  font-size: 16px;
  color: #231f20;
  margin-bottom: 2px;
}

/* Address line */
.tgm-addr-address {
  color: #231f20;
  font-size: 16px;
  font-weight: 400;
}

.tgm-change-address-btn {
  background: none;
  border: none;
  color: #a9884b;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-left: 15px;
  font-size: 16px;
  white-space: nowrap;
  text-decoration: underline;
}

.tgm-change-address-btn:hover {
  background: none;
  color: #8a6d3d;
}

/* Modal */
.tgm-address-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tgm-address-modal.active {
  opacity: 1;
  visibility: visible;
}

.tgm-address-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(35, 31, 32, 0.5);
}

.tgm-address-modal-content {
  position: relative;
  background: #ffffff;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 100000;
  transform: translateY(-30px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.tgm-address-modal.active .tgm-address-modal-content {
  transform: translateY(0);
  opacity: 1;
}

.tgm-address-modal-header {
  padding: 20px 24px;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tgm-address-modal-header h4 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #231f20;
}

.tgm-close-modal {
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  transition: color 0.2s ease;
}

.tgm-close-modal:hover {
  color: #231f20;
}

.tgm-address-modal-body {
  padding: 0 24px 24px;
  overflow-y: auto;
}

/* Address List in Modal */
.tgm-address-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tgm-address-item {
  border: 2px solid #e5e5e5;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: border-color 0.2s ease;
}

.tgm-address-item:last-child {
  margin-bottom: 0;
}

.tgm-address-item.selected {
  border-color: #a9884b;
}

.tgm-address-label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  width: 100%;
  margin-bottom: 0;
}

.tgm-radio-wrapper {
  margin-right: 15px;
  padding-top: 2px;
  flex-shrink: 0;
}

.tgm-address-radio {
  width: 20px;
  height: 20px;
  accent-color: #a9884b;
  cursor: pointer;
}

.tgm-address-details {
  flex-grow: 1;
  line-height: 1.5;
}

/* Address type label in modal (บ้าน, ที่ทำงาน) */
.tgm-address-details .tgm-addr-type {
  color: #999;
  font-size: 14px;
  margin-bottom: 4px;
}

.tgm-address-details .tgm-addr-name {
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 16px;
  color: #231f20;
}

.tgm-address-details .tgm-addr-phone {
  margin-bottom: 4px;
  color: #231f20;
  font-size: 15px;
}

.tgm-address-details .tgm-addr-line {
  color: #231f20;
  line-height: 1.5;
  font-size: 15px;
}

.tgm-address-details .tgm-addr-full {
  color: #231f20;
  line-height: 1.4;
}

.tgm-address-actions {
  border-top: 1px solid #eee;
  padding-top: 12px;
  margin-top: 15px;
}

.tgm-delete-address {
  color: #a9884b;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  font-weight: 500;
}

.tgm-delete-address:hover {
  text-decoration: underline;
  color: #8a6d3d;
}

/* ========================================
   Delete Confirmation Modal Styles
   ======================================== */

.tgm-confirm-modal-content {
  text-align: center;
  padding: 40px 30px;
  max-width: 400px;
}

.tgm-confirm-icon {
  margin-bottom: 20px;
}

.tgm-confirm-icon svg {
  width: 64px;
  height: 64px;
}

.tgm-confirm-title {
  font-size: 20px;
  font-weight: 600;
  color: #231f20;
  margin: 0 0 12px 0;
}

.tgm-confirm-message {
  font-size: 15px;
  color: #666;
  margin: 0 0 30px 0;
  line-height: 1.6;
}

.tgm-confirm-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.tgm-confirm-cancel-btn,
.tgm-confirm-delete-btn {
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.tgm-confirm-cancel-btn {
  background: #ffffff;
  border: 2px solid #a9884b;
  color: #a9884b;
}

.tgm-confirm-cancel-btn:hover {
  background: #faf8f5;
  border-color: #8a6d3d;
  color: #8a6d3d;
}

.tgm-confirm-delete-btn {
  background: #a9884b;
  border: 2px solid #a9884b;
  color: #ffffff;
}

.tgm-confirm-delete-btn:hover {
  background: #8a6d3d;
  border-color: #8a6d3d;
}

/* ========================================
   Address Book List Page Styles
   ======================================== */

/* Header with title and add button */
.tgm-address-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 1px solid #e5e5e5;
}

.tgm-address-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: #231f20;
}

.tgm-add-new-address-btn {
  display: inline-block;
  background-color: #a9884b;
  color: #ffffff !important;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.tgm-add-new-address-btn:hover {
  background-color: #8a6d3d;
  color: #ffffff !important;
}

.tgm-add-new-address-btn.tgm-btn-disabled {
  background-color: #cccccc;
  color: #888888 !important;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.7;
}

.tgm-add-new-address-btn.tgm-btn-disabled:hover {
  background-color: #cccccc;
  color: #888888 !important;
}

/* Address List Container */
.tgm-address-list-page {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Address Card */
.tgm-address-card {
  position: relative;
  padding: 20px 0;
  border-bottom: 1px solid #e5e5e5;
}

.tgm-address-card:last-child {
  border-bottom: none;
}

/* Action Button */
.tgm-action-button {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 5px;
}

/* Edit Link */
.tgm-action-link {
  color: #a9884b !important;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none !important;
  cursor: pointer;
  transition: color 0.2s ease;
}

.tgm-action-link:hover {
  color: #8a6d3d !important;
  text-decoration: underline !important;
}

/* Address Info */
.tgm-address-info {
  line-height: 1.6;
  color: #231f20;
  font-size: 15px;
}

.tgm-info-name {
  font-weight: 500;
  margin-bottom: 2px;
}

.tgm-info-phone,
.tgm-info-address,
.tgm-info-city,
.tgm-info-state,
.tgm-info-postcode {
  margin-bottom: 2px;
  color: #231f20;
}

/* No Address Message */
.tgm-no-address {
  color: #666;
  font-size: 15px;
  padding: 20px 0;
}

/* Default Address Badge */
.tgm-default-badge {
  display: inline-block;
  background-color: #a9884b;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: none;
}

/* Set Default Link */
.tgm-set-default-address {
  color: #a9884b !important;
  font-size: 14px;
  font-weight: 400;
  text-decoration: none !important;
  cursor: pointer;
  transition: color 0.2s ease;
}

.tgm-set-default-address:hover {
  color: #8a6d3d !important;
  text-decoration: underline !important;
}

/* Default Address Card Highlight */
.tgm-address-card.tgm-is-default {
  border-left: 3px solid #a9884b;
  padding-left: 17px;
}

/* ========================================
   Responsive Styles for Address Book List
   ======================================== */

@media screen and (max-width: 768px) {
  .tgm-address-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .tgm-address-title {
    font-size: 16px;
  }

  .tgm-add-new-address-btn {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
  }

  .tgm-address-card {
    padding: 15px 0;
  }

  .tgm-address-info {
    font-size: 14px;
  }

  .tgm-address-modal-content {
    width: 95%;
    max-height: 85vh;
  }

  .tgm-address-modal-header {
    padding: 16px 20px;
  }

  .tgm-address-modal-header h4 {
    font-size: 20px;
  }

  .tgm-address-modal-body {
    padding: 0 20px 20px;
  }

  .tgm-address-item {
    padding: 16px;
    margin-bottom: 12px;
  }

  .tgm-confirm-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .tgm-confirm-cancel-btn,
  .tgm-confirm-delete-btn {
    width: 100%;
    min-width: auto;
  }
}

@media screen and (max-width: 480px) {
  .tgm-address-book-container {
    padding: 0 10px;
  }

  .tgm-address-title {
    font-size: 15px;
  }

  .tgm-add-new-address-btn {
    font-size: 13px;
    padding: 10px 15px;
  }

  .tgm-address-info {
    font-size: 13px;
  }

  .tgm-selected-address-box {
    padding: 15px;
  }

  .tgm-selected-address-content {
    font-size: 14px;
  }

  .tgm-addr-name-phone,
  .tgm-addr-address {
    font-size: 14px;
  }

  .tgm-addr-tax-label {
    font-size: 12px;
  }

  .tgm-change-address-btn {
    font-size: 14px;
  }

  .tgm-address-modal-header h4 {
    font-size: 18px;
  }

  .tgm-confirm-modal-content {
    padding: 30px 20px;
  }

  .tgm-confirm-title {
    font-size: 18px;
  }

  .tgm-confirm-message {
    font-size: 14px;
  }

  .tgm-confirm-cancel-btn,
  .tgm-confirm-delete-btn {
    font-size: 14px;
    padding: 10px 30px;
  }
}

/**
 * Error message
 */
.woocommerce-invalid label {
  color: #c33739;
}

.woocommerce-invalid input,
.woocommerce-invalid select,
.woocommerce-invalid textarea {
  border-color: #c33739 !important;
}

.woocommerce-input-wrapper .tgm-error-message {
  color: #c33739;
}

.tgm-address-book .woocommerce .form-row {
  margin-bottom: 0 !important;
}

.tgm-address-book .woocommerce-address-fields__field-wrapper,
.tgm-address-book .woocommerce-shipping-fields__field-wrapper,
.tgm-address-book .woocommerce-billing-fields__field-wrapper {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tgm-address-book .woocommerce .form-row-first,
.tgm-address-book .woocommerce .form-row-last {
  width: 100% !important;
  float: none !important;
}

/* make email and address_1 in the same row */
.tgm-address-book .woocommerce .form-row-wide {
  grid-column: span 2;
}

.tgm-address-book .woocommerce-billing-fields {
  margin-top: 30px;
}

.tgm-address-book .thwcfe-optional .required {
  display: inline-block;
}