/**
 * Frontend styles for WooCommerce Back in Stock Notifier
 */

/* Main subscription form wrapper */
.wc-bis-subscription-form-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    clear: both;
}

/* Form heading */
.wc-bis-subscription-form h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

/* Expected date display */
.wc-bis-expected-date {
    background: #fff;
    padding: 10px;
    border-left: 3px solid #4CAF50;
    margin-bottom: 15px;
}

/* Form fields */
.wc-bis-form {
    margin-top: 15px;
}

.wc-bis-field {
    margin-bottom: 15px;
}

.wc-bis-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.wc-bis-field input[type="text"],
.wc-bis-field input[type="email"] {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.wc-bis-field input[type="text"]:focus,
.wc-bis-field input[type="email"]:focus {
    border-color: #333;
    outline: none;
    box-shadow: 0 0 3px rgba(0,0,0,0.1);
}

/* Privacy checkbox */
.wc-bis-privacy label {
    display: flex;
    align-items: flex-start;
    font-weight: normal;
    font-size: 14px;
}

.wc-bis-privacy input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
}

/* Submit button */
.wc-bis-submit {
    background: #333;
    color: #fff !important;
    padding: 12px 30px !important;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.wc-bis-submit:hover {
    background: #555;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.wc-bis-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading state */
.wc-bis-form.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.wc-bis-form.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: wc-bis-spin 1s linear infinite;
}

@keyframes wc-bis-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message display */
.wc-bis-message {
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-weight: 600;
}

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

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

/* Already subscribed state */
.wc-bis-already-subscribed {
    padding: 15px;
    background: #e7f3ff;
    border-left: 3px solid #2196F3;
}

.wc-bis-already-subscribed p {
    margin: 0 0 10px 0;
    color: #0c5460;
}

.wc-bis-unsubscribe {
    background: #fff;
    color: #333;
    border: 1px solid #333;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.wc-bis-unsubscribe:hover {
    background: #333;
    color: #fff;
}

/* Variation form */
.wc-bis-variation-form {
    margin-top: 15px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .wc-bis-subscription-form-wrapper {
        padding: 15px;
    }
    
    .wc-bis-field input[type="text"],
    .wc-bis-field input[type="email"] {
        max-width: 100%;
    }
    
    .wc-bis-submit {
        width: 100%;
        padding: 15px !important;
    }
}

/* Integration with common themes */
.twentytwenty .wc-bis-subscription-form-wrapper,
.twentytwentyone .wc-bis-subscription-form-wrapper {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Storefront theme compatibility */
.storefront .wc-bis-subscription-form-wrapper {
    margin-top: 2em;
    margin-bottom: 2em;
}

/* Flatsome theme compatibility */
.flatsome .wc-bis-subscription-form-wrapper {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Required field indicator */
.wc-bis-field .required {
    color: #dc3545;
}

/* Success animation */
@keyframes wc-bis-success-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.wc-bis-message.success {
    animation: wc-bis-success-pulse 2s;
}

/* Out of stock badge enhancement */
.wc-bis-subscription-form-wrapper.badge-style {
    position: relative;
}

.wc-bis-subscription-form-wrapper.badge-style::before {
    content: "OUT OF STOCK";
    position: absolute;
    top: -10px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 5px 15px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
}

/* Custom button colors (can be overridden by settings) */
.wc-bis-submit.custom-color {
    background: var(--wc-bis-button-color, #333);
}

.wc-bis-submit.custom-color:hover {
    filter: brightness(1.2);
}

/* Accessibility improvements */
.wc-bis-field input:focus,
.wc-bis-field button:focus {
    outline: 2px solid #4169E1;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .wc-bis-subscription-form-wrapper {
        display: none;
    }
}
