/**
 * Newsletter Block Styles
 * Modern, responsive design with accessibility focus
 * 
 * @package BistroDistro
 */

/* ===================================
   Block Container
   =================================== */
.newsletter-block {
    padding: 60px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Default background - only applied if no inline style is set */
.newsletter-block:not([style*="background-image"]):not([style*="background-color"]) {
    background: linear-gradient(135deg, var(--color-primary, #667eea) 0%, var(--color-secondary, #764ba2) 100%);
}

/* Default text color - only applied if no inline style is set */
.newsletter-block:not([style*="color"]) {
    color: #ffffff;
}

.newsletter-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.newsletter-block__content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

/* ===================================
   Logo
   =================================== */
.newsletter-block__logo {
    margin: 0 auto 2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.newsletter-block__logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* ===================================
   Typography
   =================================== */
.newsletter-block__headline {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.newsletter-block__subheadline {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.newsletter-block__copytext {
    font-size: 1rem;
    margin-bottom: 2rem;
    opacity: 0.85;
    line-height: 1.6;
}

/* Text color inheritance for custom colors */
.newsletter-block__headline,
.newsletter-block__subheadline,
.newsletter-block__copytext {
    color: inherit;
}

/* ===================================
   Form Styles
   =================================== */
.newsletter-form {
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-form__fields {
    margin-bottom: 1rem;
}

.newsletter-form__name-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.newsletter-form__email-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.newsletter-form__input {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.newsletter-form__input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.newsletter-form__input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.newsletter-form__input:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Input validation states */
.newsletter-form__input:invalid:not(:placeholder-shown) {
    border-color: rgba(244, 67, 54, 0.6);
}

.newsletter-form__input:valid:not(:placeholder-shown) {
    border-color: rgba(76, 175, 80, 0.6);
}

/* ===================================
   Button Styles
   =================================== */
.newsletter-form__button {
    padding: 14px 30px;
    background: #ffffff;
    color: var(--color-primary, #667eea);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 150px;
}

.newsletter-form__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    background: #f8f9fa;
}

.newsletter-form__button:active {
    transform: translateY(0);
}

.newsletter-form__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.newsletter-form__button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Loading state */
.newsletter-form--loading .newsletter-form__button {
    position: relative;
    color: transparent;
}

.newsletter-form--loading .newsletter-form__button::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--color-primary, #667eea);
    border-radius: 50%;
    border-top-color: transparent;
    animation: newsletter-spinner 0.6s linear infinite;
}

@keyframes newsletter-spinner {
    to { transform: rotate(360deg); }
}

/* ===================================
   Messages
   =================================== */
.newsletter-messages {
    margin-top: 1rem;
}

.newsletter-success,
.newsletter-error {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: newsletter-fade-in 0.3s ease;
}

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

.newsletter-success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #ffffff;
}

.newsletter-error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: #ffffff;
}

/* ===================================
   Privacy Text
   =================================== */
.newsletter-privacy {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    opacity: 0.7;
    line-height: 1.5;
}

.newsletter-privacy a {
    color: #ffffff;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.newsletter-privacy a:hover {
    opacity: 0.8;
}

.newsletter-privacy a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ===================================
   Admin Notice
   =================================== */
.newsletter-admin-notice {
    background: rgba(255, 152, 0, 0.2);
    border: 2px solid rgba(255, 152, 0, 0.5);
    padding: 20px;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: left;
}

.newsletter-admin-notice p {
    margin: 0 0 0.75rem 0;
}

.newsletter-admin-notice p:last-child {
    margin-bottom: 0;
}

.newsletter-admin-notice ul {
    margin: 0.5rem 0 1rem 1.5rem;
    padding: 0;
}

.newsletter-admin-notice li {
    margin-bottom: 0.25rem;
}

.newsletter-admin-notice__link {
    display: inline-block;
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    padding: 8px 16px;
    background: rgba(255, 152, 0, 0.3);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.newsletter-admin-notice__link:hover {
    background: rgba(255, 152, 0, 0.4);
    transform: translateX(4px);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .newsletter-block {
        padding: 40px 20px;
    }
    
    .newsletter-block__headline {
        font-size: 2rem;
    }
    
    .newsletter-block__subheadline {
        font-size: 1.125rem;
    }
    
    .newsletter-block__copytext {
        font-size: 0.95rem;
    }
    
    .newsletter-form__name-fields {
        grid-template-columns: 1fr;
    }
    
    .newsletter-form__email-wrapper {
        flex-direction: column;
    }
    
    .newsletter-form__input,
    .newsletter-form__button {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .newsletter-block {
        padding: 30px 15px;
        border-radius: 0;
    }
    
    .newsletter-block__headline {
        font-size: 1.75rem;
    }
    
    .newsletter-block__subheadline {
        font-size: 1rem;
    }
    
    .newsletter-form__input,
    .newsletter-form__button {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* ===================================
   Accessibility Enhancements
   =================================== */
@media (prefers-reduced-motion: reduce) {
    .newsletter-block::before,
    .newsletter-form__button,
    .newsletter-form__input,
    .newsletter-success,
    .newsletter-error,
    .newsletter-admin-notice__link {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .newsletter-form__input {
        border-width: 3px;
    }
    
    .newsletter-form__button {
        border: 2px solid currentColor;
    }
}

/* Dark mode adjustments (if theme supports it) */
@media (prefers-color-scheme: dark) {
    .newsletter-block {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
}

/* ===================================
   Sticky Tab
   =================================== */
.newsletter-sticky-tab {
    position: fixed;
    bottom: 30px;
    left: -300px; /* Start off-screen */
    z-index: 9999;
    transition: left 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.newsletter-sticky-tab--visible {
    left: 0; /* Slide into view */
}

.newsletter-sticky-tab--hidden {
    left: -300px; /* Slide out */
    opacity: 0;
}

.newsletter-sticky-tab__close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-primary, #667eea);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    z-index: 10;
}

.newsletter-sticky-tab__close:hover {
    background: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.newsletter-sticky-tab__close:active {
    transform: scale(0.95);
}

.newsletter-sticky-tab__close svg {
    display: block;
}

.newsletter-sticky-tab__button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px 14px 20px;
    background: linear-gradient(135deg, var(--color-primary, #667eea) 0%, var(--color-secondary, #764ba2) 100%);
    color: #ffffff;
    border: none;
    border-radius: 0 8px 8px 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.newsletter-sticky-tab__button:hover {
    transform: translateX(0px);
    box-shadow: 4px 6px 20px rgba(0, 0, 0, 0.25);
}

.newsletter-sticky-tab__button:active {
    transform: translateX(10px) scale(0.98);
}

.newsletter-sticky-tab__icon {
    flex-shrink: 0;
    animation: newsletter-heart-beat 1.5s ease-in-out infinite;
}

@keyframes newsletter-heart-beat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

.newsletter-sticky-tab__text {
    font-size: 16px;
    line-height: 1.2;
}

/* Mobile adjustments for sticky tab */
@media (max-width: 768px) {
    .newsletter-sticky-tab {
        bottom: 32px;
    }
    
    .newsletter-sticky-tab__button {
        padding: 12px 20px 12px 16px;
        font-size: 14px;
    }
    
    .newsletter-sticky-tab__icon {
        width: 18px;
        height: 18px;
    }
    
    .newsletter-sticky-tab__text {
        font-size: 14px;
    }
}

/* ===================================
   Stage Presence (Hero CTA Button)
   =================================== */
.newsletter-stage-cta--active {
    position: relative;
    animation: newsletter-stage-pulse 3s ease-in-out infinite;
}

.newsletter-stage-cta--active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: inherit;
    border-radius: inherit;
    opacity: 0;
    animation: newsletter-stage-pulse-ring 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes newsletter-stage-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 15px 5px rgba(102, 126, 234, 0);
    }
}

@keyframes newsletter-stage-pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
}

/* Hover state for stage CTA */
.newsletter-stage-cta--active:hover {
    animation: none;
    transform: scale(1.05);
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .newsletter-block {
        background: none;
        color: #000;
        border: 1px solid #ccc;
    }
    
    .newsletter-form,
    .newsletter-admin-notice,
    .newsletter-sticky-tab {
        display: none;
    }
}
