/* WooCommerce Stock Notifier Frontend Styles */

.wc-stock-notifier-form {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #f9f9f9;
}

/* Initially hide stock notifier forms on variable products */
.variations_form .wc-stock-notifier-form {
    display: none;
}

.wc-stock-notifier-form h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.wc-stock-notifier-form p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.wc-stock-notifier-field {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* When no email field, center the button */
.wc-stock-notifier-field:not(:has(input[type="email"])) {
    justify-content: center;
}

.wc-stock-notifier-field input[type="email"] {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1.4;
}

.wc-stock-notifier-field input[type="email"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

.wc-stock-notifier-subscribe-btn {
    padding: 10px 20px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.wc-stock-notifier-subscribe-btn:hover {
    background-color: #005a87;
}

.wc-stock-notifier-subscribe-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.wc-stock-notifier-message {
    margin: 15px 0;
    padding: 10px 15px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
}

.wc-stock-notifier-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wc-stock-notifier-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wc-stock-notifier-subscribed {
    text-align: center;
}

.wc-stock-notifier-confirmation {
    text-align: center;
}

.wc-stock-notifier-confirmation h4 {
    color: #dc3232;
    margin: 0 0 10px 0;
}

.wc-stock-notifier-confirmation p {
    margin: 0 0 15px 0;
    color: #666;
}

.wc-stock-notifier-subscribed h4 {
    color: #28a745;
    margin: 0 0 10px 0;
}

.wc-stock-notifier-subscribed p {
    margin: 0 0 15px 0;
    color: #666;
}

.wc-stock-notifier-unsubscribe-btn {
    padding: 8px 16px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wc-stock-notifier-unsubscribe-btn:hover {
    background-color: #545b62;
}

/* Message styles */
.wc-stock-notifier-message.info {
    background-color: #f0f8ff;
    border: 1px solid #0073aa;
    color: #0073aa;
}

/* Confirmation buttons in messages */
.wc-stock-notifier-message .button {
    margin: 5px;
    padding: 8px 12px;
    font-size: 13px;
}

.wc-stock-notifier-message .wc-stock-notifier-confirm-unsubscribe {
    background-color: #dc3232;
    border-color: #dc3232;
    color: #fff;
}

.wc-stock-notifier-message .wc-stock-notifier-confirm-unsubscribe:hover {
    background-color: #a00;
    border-color: #a00;
}

.wc-stock-notifier-message .wc-stock-notifier-cancel-unsubscribe {
    background-color: #666;
    border-color: #666;
    color: #fff;
}

.wc-stock-notifier-message .wc-stock-notifier-cancel-unsubscribe:hover {
    background-color: #555;
    border-color: #555;
}

/* Confirmation buttons */
.wc-stock-notifier-confirmation .wc-stock-notifier-confirm-unsubscribe {
    background-color: #dc3232;
    border-color: #dc3232;
    color: #fff;
    margin-right: 10px;
}

.wc-stock-notifier-confirmation .wc-stock-notifier-confirm-unsubscribe:hover {
    background-color: #a00;
    border-color: #a00;
}

.wc-stock-notifier-confirmation .wc-stock-notifier-cancel-unsubscribe {
    background-color: #666;
    border-color: #666;
    color: #fff;
}

.wc-stock-notifier-confirmation .wc-stock-notifier-cancel-unsubscribe:hover {
    background-color: #555;
    border-color: #555;
}

/* Loading state */
.wc-stock-notifier-loading .wc-stock-notifier-subscribe-btn {
    position: relative;
    color: transparent;
}

.wc-stock-notifier-loading .wc-stock-notifier-subscribe-btn:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: wc-stock-notifier-spin 1s linear infinite;
}

@keyframes wc-stock-notifier-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .wc-stock-notifier-field {
        flex-direction: column;
        gap: 10px;
    }
    
    .wc-stock-notifier-field input[type="email"] {
        width: 100%;
    }
    
    .wc-stock-notifier-subscribe-btn {
        width: 100%;
    }
}

/* WooCommerce theme compatibility */
.woocommerce .wc-stock-notifier-form {
    background-color: #f8f8f8;
    border-color: #e0e0e0;
}

.woocommerce .wc-stock-notifier-subscribe-btn {
    background-color: #a46497;
}

.woocommerce .wc-stock-notifier-subscribe-btn:hover {
    background-color: #8b4a7f;
}
