/**
 * Frontend styles for Stock Message for WooCommerce
 * Handles styling for notification buttons, modals, and forms displayed to customers
 */

/* Theme customization variables */
:root {
  --stock-message-primary-color: #0071a1;
  --stock-message-primary-hover-color: #005a87;
  --stock-message-text-color: #333;
  --stock-message-border-color: #ddd;
  --stock-message-success-bg: #e7f5ea;
  --stock-message-success-border: #c3e6cb;
  --stock-message-success-text: #155724;
  --stock-message-error-bg: #f8d7da;
  --stock-message-error-border: #f5c6cb;
  --stock-message-error-text: #721c24;
  --stock-message-disabled-bg: #cccccc;
  --stock-message-modal-bg: #fefefe;
  --stock-message-modal-overlay: rgba(0, 0, 0, 0.4);
  --stock-message-button-margin: 0.5rem 0;
  --stock-message-button-padding: 0.25rem 0.5rem;
}

/* Stock status layout */
.stock.out-of-stock {
  display: flex;
  flex-direction: column;
}

.stock.restock-date {
  margin-top: 0;
}

/* Spacing adjustments for restock dates */
.stock.out-of-stock:has(+ .stock.restock-date),
.stock.available-on-backorder:has(+ .stock.restock-date) {
  margin-bottom: 0.25rem;
}

/* Notification button styling */
.stock-message-notify-button {
  display: flex;
  width: fit-content;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.stock-message-notify-button.stock-message-hover-effect:hover {
  background-color: var(--hover-color, #333);
}

/* Modal structure and animations */
.stock-message-modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--stock-message-modal-overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.stock-message-modal.is-active {
  opacity: 1;
  visibility: visible;
}

/* Modal content container */
.stock-message-modal-content {
  background-color: var(--stock-message-modal-bg);
  padding: 1.875rem;
  border-radius: 0.3125rem;
  box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.1);
  max-width: 90%;
  position: relative;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Modal size variations */
.stock-message-modal-content.small {
  width: 18.75rem;
}

.stock-message-modal-content.medium {
  width: 31.25rem;
}

.stock-message-modal-content.large {
  width: 43.75rem;
}

.stock-message-modal.is-active .stock-message-modal-content {
  opacity: 1;
  transform: translateY(0);
}

/* Modal close button */
.stock-message-close-modal {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  cursor: pointer;
  color: var(--stock-message-text-color);
  font-size: 1.25rem;
}

.stock-message-close-modal:hover {
  color: var(--stock-message-primary-color);
}

/* Modal header */
.stock-message-modal-content h3 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: 1.125rem;
  color: var(--stock-message-text-color);
}

/* Notification form styling */
#stock-message-notify-form {
  display: flex;
  flex-direction: column;
}

#stock-message-notify-form .g-recaptcha {
  padding: 1rem 0;
}

/* Form input fields */
#stock-message-notify-form input[type="email"] {
  padding: 0.625rem;
  border: 0.0625rem solid var(--stock-message-border-color);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

/* Form submit button */
#stock-message-notify-form button {
  background-color: var(--stock-message-primary-color);
  border: 0.0625rem solid var(--stock-message-primary-color);
  color: #fff;
  padding: 0.625rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border-radius: 0.25rem;
  line-height: 1.5;
}

#stock-message-notify-form button:hover {
  background-color: var(--stock-message-primary-hover-color);
}

#stock-message-notify-form button:disabled {
  background-color: var(--stock-message-disabled-bg);
  border-color: var(--stock-message-disabled-bg);
  cursor: not-allowed;
}

/* Notification messages */
.stock-message-success,
.stock-message-error {
  font-size: 0.8rem;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.9375rem;
}

.stock-message-success {
  background-color: var(--stock-message-success-bg);
  border: 0.0625rem solid var(--stock-message-success-border);
  color: var(--stock-message-success-text);
}

.stock-message-error {
  background-color: var(--stock-message-error-bg);
  border: 0.0625rem solid var(--stock-message-error-border);
  color: var(--stock-message-error-text);
}

.stock-message-success p,
.stock-message-error p {
  margin: 0;
}

/* Mobile responsiveness */
@media screen and (max-width: 37.5rem) {
  .stock-message-modal-content {
    margin: 1rem;
    padding: 1.25rem;
    width: calc(100% - 2rem);
  }

  .stock-message-modal-content h3 {
    font-size: 1rem;
  }
}
