/* Subscription Popup Styles - Shared across all pages */

.subscription-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: smoothFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    isolation: isolate;
}

/* Image Background Styles - contained within the popup box */
.subscription-image-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    border-radius: 16px; /* Match the popup box border radius */
    background: #000; /* Fallback background */
}

.subscription-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/src/assets/images/Front Page Background 11.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Lighter overlay to show more of the background image */
    z-index: 1;
    border-radius: 16px; /* Match the popup box border radius */
}

/* Responsive image background - contained within popup box */
@media (max-width: 768px) {
    .subscription-bg-image {
        background-size: cover;
        background-position: center;
    }
}

@media (max-width: 480px) {
    .subscription-bg-image {
        background-size: cover;
        background-position: center;
    }
}

.subscription-popup-overlay.closing {
    animation: smoothFadeOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: none;
    z-index: -1;
    isolation: auto;
}

.subscription-content {
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    margin: 0 auto;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.95);
    animation: smoothFadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
    overflow: hidden;
    isolation: isolate;
    z-index: 10;
}

.subscription-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: -1;
}

.subscription-content > *:not(.subscription-image-background) {
    position: relative;
    z-index: 1;
}

/* Close button */
.subscription-inline-close {
    position: absolute !important;
    top: 1.25rem !important;
    right: 1.25rem !important;
    left: auto !important;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    font-weight: 300;
    z-index: 10000 !important;
    pointer-events: auto !important;
}

.subscription-inline-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: scale(1.05);
}

/* Header */
.subscription-header {
    text-align: center;
    padding: 1.25rem 2.5rem 1.5rem 2.5rem;
}

.research-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    background-image: linear-gradient(to right, #ffffff, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.subscription-header .access-heading {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 300;
    color: #ffffff;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.03em;
    line-height: 1.2;
    text-transform: none;
    font-family: "Times New Roman", Times, serif;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subscription-header .access-heading em {
    font-style: italic;
    font-weight: inherit;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.9) 0%, rgba(200, 200, 200, 0.8) 50%, rgba(180, 180, 180, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subscription-header .access-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
    text-align: center;
}

/* Form */
.subscription-form {
    width: 100%;
    min-width: 0;
    padding: 0 2.5rem 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.subscription-input-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    min-width: 300px;
    box-sizing: border-box;
    align-items: stretch;
}

.subscription-input {
    flex: 1 1 0;
    min-width: 200px;
    width: 0;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    font-family: InterVariable, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
    min-height: 48px;
    box-sizing: border-box;
}

.subscription-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.subscription-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Scoped to popup overlay for higher specificity than index.css */
.subscription-popup-overlay .subscription-button {
    padding: 1rem 1.25rem;
    background: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 10px;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    font-family: InterVariable, Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
    min-height: 48px;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    width: auto;
    max-width: none;
}

.subscription-popup-overlay .subscription-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.subscription-popup-overlay .subscription-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.subscription-disclaimer {
    margin: 0.25rem auto 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    line-height: 1.4;
    text-align: center !important;
    width: 100%;
    max-width: 400px;
    display: block;
    justify-self: center;
    align-self: center;
}

/* Ensure single line on mobile by default */
@media (max-width: 640px) {
    .subscription-disclaimer {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.6rem !important;
        letter-spacing: 0.04em !important;
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
        width: 100% !important;
    }
}

/* Smooth Animations */
@keyframes smoothFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes smoothFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes smoothFadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes smoothSlideUp {
    from {
        transform: translateY(20px);
    }
    to {
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .subscription-content {
        max-width: 95%;
        width: calc(100vw - 2rem);
        max-height: 85vh;
        overflow-y: auto;
    }

    .subscription-inline-close {
        top: 0.75rem !important;
        right: 0.75rem !important;
        left: auto !important;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .subscription-header {
        padding: 1.5rem 1.25rem 0.75rem 1.25rem;
    }

    .research-badge {
        margin-bottom: 0.5rem;
        padding: 0.3rem 0.65rem;
        font-size: 0.65rem;
    }

    .subscription-header .access-heading {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
    }

    .subscription-header .access-subtitle {
        font-size: 0.85rem;
    }

    .subscription-form {
        padding: 0 1.25rem 1rem 1.25rem;
    }

    .subscription-input-wrapper {
        flex-direction: column;
        margin-bottom: 0.5rem;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .subscription-input {
        width: 100%;
        min-width: 0;
        padding: 0.875rem 1.125rem;
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 48px;
        box-sizing: border-box;
    }

    .subscription-popup-overlay .subscription-button {
        width: 100%;
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
        min-height: 48px;
        box-sizing: border-box;
    }

    .subscription-disclaimer {
        font-size: 0.7rem;
        margin-top: 0.4rem;
    }
}

@media (max-width: 480px) {
    .subscription-content {
        max-width: calc(100vw - 2rem);
    }

    .subscription-header {
        padding: 1.75rem 1rem 1rem 1rem;
    }

    .subscription-header .access-heading {
        font-size: 1.5rem;
    }

    .subscription-header .access-subtitle {
        font-size: 0.8rem;
    }

    .subscription-form {
        padding: 0 1rem 1.25rem 1rem;
    }

    .subscription-disclaimer {
        font-size: 0.65rem;
    }
}

/* iOS-specific optimizations */
@supports (-webkit-touch-callout: none) {
  .subscription-content {
    min-width: 0;
    min-height: auto;
    height: auto;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem 1.5rem 2rem 1.5rem;
    max-width: 400px;
    width: 95%;
    margin: 0 auto;
    position: relative;
  }

  /* Prevent iOS zoom-on-focus by ensuring 16px font-size */
  .subscription-input {
    font-size: 16px;
    padding: 1rem 1.25rem;
    min-height: 48px;
  }

  /* Larger, full-width tap target */
  .subscription-popup-overlay .subscription-button {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    min-height: 48px;
  }

  .subscription-inline-close {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}

/* Extra small screens - optimize for compactness */
@media (max-width: 400px) {
  .subscription-content {
    gap: 1rem;
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    max-width: 400px;
    width: 95%;
  }
}

/* Extra small screens - optimize disclaimer text */
@media (max-width: 360px) {
    .subscription-disclaimer {
        font-size: 0.45rem !important;
        line-height: 1.1 !important;
        letter-spacing: 0em !important;
        word-spacing: 0em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
