/**
 * Newsletter Subscription Styles
 * Enhanced styling for newsletter form and components
 */

/* Newsletter Form Container */
.newsletter-form {
    transition: all 0.3s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.newsletter-form:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Input Container */
.newsletter-input-container {
    position: relative;
}

.newsletter-input-container .input-group {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.newsletter-input-container .input-group.newsletter-focused {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    border-radius: 8px;
}

/* Email Input Styling */
.newsletter-email-input {
    border: 2px solid #e9ecef;
    border-right: none;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
}

.newsletter-email-input:focus {
    border-color: #007bff;
    background: white;
    box-shadow: none;
}

.newsletter-email-input.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-color: rgba(255, 255, 255, 0.98);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.8-.77L4.1 7l2.1-2.1.8.77-2.9 2.9z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.newsletter-email-input.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-color: rgba(255, 255, 255, 0.98);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 2.8m0-2.8-1.4 2.8'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Submit Button Styling */
.newsletter-form #newsletter-submit {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    padding: 12px 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.newsletter-form #newsletter-submit:hover:not(:disabled) {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.newsletter-form #newsletter-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.newsletter-form #newsletter-submit .submit-loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* GDPR Checkbox */
.newsletter-gdpr {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Ensure proper Bootstrap form-check alignment */
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: auto;
}

.newsletter-gdpr .form-check-input {
    width: 1.1em;
    height: 1.1em;
    border: 2px solid #ccc;
    transition: all 0.3s ease;
    /* Reset Bootstrap defaults for proper alignment */
    margin-top: 0.125rem;
    margin-left: 0;
    flex-shrink: 0;
    position: relative;
}

.newsletter-gdpr .form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

.newsletter-gdpr .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
    border-color: #198754;
}

.newsletter-gdpr .form-check-input:focus-visible {
    outline: 2px solid #198754;
    outline-offset: 2px;
}

.newsletter-gdpr .form-check-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-left: 0;
    margin-bottom: 0;
    flex: 1;
    cursor: pointer;
}

.newsletter-gdpr .form-check-label a {
    color: #ffd700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: all 0.3s ease;
}

.newsletter-gdpr .form-check-label a:hover {
    color: #ffed4a;
    text-decoration-thickness: 2px;
}

/* Message Container */
.newsletter-message {
    margin-top: 15px;
}

.newsletter-alert {
    font-size: 0.9rem;
    border-radius: 8px;
    border: none;
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.newsletter-alert.alert-success {
    background: rgba(25, 135, 84, 0.9);
    color: white;
}

.newsletter-alert.alert-danger {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.newsletter-alert.alert-info {
    background: rgba(13, 110, 253, 0.9);
    color: white;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Benefits List */
.newsletter-benefits {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.benefit-item:hover {
    opacity: 1;
}

.benefit-item:last-child {
    margin-bottom: 0;
}

.benefit-item i {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.benefit-item small {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Animation for newsletter section visibility */
.newsletter-visible {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.newsletter-form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.newsletter-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

/* Success State */
.newsletter-form.success {
    background: rgba(25, 135, 84, 0.1);
    border-color: rgba(25, 135, 84, 0.3);
}

/* Error State */
.newsletter-form.error {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.3);
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== Newsletter GDPR Checkbox Fix ===== */
.newsletter-gdpr {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    padding-left: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: auto;
    margin-bottom: 1rem;
}

.newsletter-gdpr .form-check-input {
    margin-left: 0 !important;
    margin-top: 0.125rem;
    flex-shrink: 0;
    position: relative;
}

.newsletter-gdpr .form-check-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

.newsletter-gdpr .form-check-label {
    margin-left: 0;
    margin-bottom: 0;
    flex: 1;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

/* Responsive adjustments for GDPR checkbox */
@media (max-width: 768px) {
    .newsletter-gdpr {
        padding: 8px;
        gap: 6px;
    }
    
    .newsletter-gdpr .form-check-input {
        width: 1em;
        height: 1em;
    }
    
    .newsletter-gdpr .form-check-label {
        font-size: 0.75rem;
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .newsletter-form {
        padding: 15px;
    }
    
    .newsletter-form #newsletter-submit {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .newsletter-form {
        text-align: center;
        padding: 20px 15px;
    }
    
    .newsletter-benefits {
        text-align: left;
    }
    
    .newsletter-gdpr {
        text-align: left;
        padding: 10px;
        gap: 6px;
    }
    
    .newsletter-gdpr .form-check-label {
        font-size: 0.8rem;
    }
    
    .newsletter-input-container .input-group {
        flex-direction: column;
    }
    
    .newsletter-input-container .input-group .form-control {
        border-right: 2px solid #e9ecef;
        border-bottom: none;
        border-radius: 8px 8px 0 0;
    }
    
    .newsletter-input-container .input-group .btn {
        border-radius: 0 0 8px 8px;
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .newsletter-form {
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .newsletter-gdpr {
        padding: 8px;
        gap: 6px;
        margin-top: 10px;
    }
    
    .newsletter-gdpr .form-check-input {
        width: 1em;
        height: 1em;
    }
    
    .newsletter-gdpr .form-check-label {
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    .benefit-item small {
        font-size: 0.75rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .newsletter-form {
        border: 2px solid #fff;
        background: rgba(0, 0, 0, 0.8);
    }
    
    .newsletter-email-input {
        border-width: 3px;
    }
    
    .newsletter-gdpr .form-check-label {
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .newsletter-form,
    .newsletter-email-input,
    .newsletter-form #newsletter-submit,
    .benefit-item,
    .newsletter-alert {
        transition: none;
        animation: none;
    }
    
    .newsletter-form:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .newsletter-form {
        background: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .newsletter-form #newsletter-submit,
    .newsletter-benefits {
        display: none;
    }
}