/**
 * Signup Popup Styles
 *
 * Visually consistent with login-modal.css.
 * Includes responsive design and dark mode support.
 *
 * @package SampleHQ\Platform
 */

/* ------------------------------------------------------------------ */
/* Popup wrapper & overlay                                            */
/* ------------------------------------------------------------------ */

.trial-signup-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.trial-signup-popup.active {
    opacity: 1;
    visibility: visible;
    display: block !important;
}

.trial-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

body.popup-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Modal container                                                    */
/* ------------------------------------------------------------------ */

.trial-popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: #ffffff;
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease;
}

.trial-signup-popup.active .trial-popup-container {
    transform: translate(-50%, -50%) scale(1);
}

/* ------------------------------------------------------------------ */
/* Close button                                                       */
/* ------------------------------------------------------------------ */

.trial-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
    z-index: 10;
}

.trial-popup-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.trial-popup-close svg {
    width: 20px;
    height: 20px;
}

/* ------------------------------------------------------------------ */
/* Header                                                             */
/* ------------------------------------------------------------------ */

.trial-popup-header {
    text-align: center;
    margin-bottom: 24px;
}

.trial-popup-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.2;
}

.trial-popup-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Plan badge                                                         */
/* ------------------------------------------------------------------ */

.trial-popup-plan {
    text-align: center;
    margin-bottom: 24px;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
}

.plan-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--site-primary, var(--global-palette1, #1d4ed8));
}

.plan-trial {
    font-size: 13px;
    color: #6b7280;
}

/* ------------------------------------------------------------------ */
/* SSO buttons — icon-only 3-column grid                              */
/* ------------------------------------------------------------------ */

.trial-popup-sso {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.sso-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    padding: 0;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #374151;
    position: relative;
}

.sso-button:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sso-icon {
    width: 24px;
    height: 24px;
}

/* ------------------------------------------------------------------ */
/* Separator                                                          */
/* ------------------------------------------------------------------ */

.trial-popup-divider {
    position: relative;
    margin: 0 0 24px;
    text-align: center;
}

.trial-popup-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.trial-popup-divider span {
    position: relative;
    display: inline-block;
    padding: 0 12px;
    background: #ffffff;
    color: #9ca3af;
    font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Email form                                                         */
/* ------------------------------------------------------------------ */

.trial-popup-email-form .form-group {
    margin-bottom: 12px;
}

.trial-popup-email-form input[type="email"] {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.trial-popup-email-form input[type="email"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.trial-popup-email-form input[type="email"]::placeholder {
    color: #9ca3af;
}

/* ------------------------------------------------------------------ */
/* Submit button                                                      */
/* ------------------------------------------------------------------ */

.trial-email-submit {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--site-primary, var(--global-palette1, var(--global-palette-btn-bg, #1d4ed8)));
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-sizing: border-box;
}

.trial-email-submit:hover {
    background: var(--site-primary-hover, var(--global-palette1-hover, var(--global-palette-btn-bg-hover, #1e40af)));
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.trial-email-submit:active {
    background: var(--site-primary-active, var(--global-palette1-active, var(--global-palette-btn-bg-active, #1e3a8a)));
    transform: translateY(0);
}

.trial-email-submit:focus {
    outline: 2px solid var(--site-primary, var(--global-palette1, var(--global-palette-btn-bg, #1d4ed8)));
    outline-offset: 2px;
}

.trial-email-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.trial-email-submit svg {
    width: 18px;
    height: 18px;
}

/* Loading state */
.trial-email-submit.loading span,
.trial-email-submit.loading svg {
    opacity: 0;
}

.trial-email-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: shqpSpin 0.8s linear infinite;
}

@keyframes shqpSpin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* Message area                                                       */
/* ------------------------------------------------------------------ */

.trial-email-message {
    text-align: center;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.trial-email-message.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.trial-email-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

.trial-popup-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.trial-popup-footer p {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 8px;
}

.trial-popup-footer a {
    color: var(--site-primary, var(--global-palette1, #1d4ed8));
    text-decoration: none;
}

.trial-popup-footer a:hover {
    text-decoration: underline;
}

.trial-popup-footer .already-account {
    margin-top: 12px;
}

/* ------------------------------------------------------------------ */
/* Turnstile widget                                                   */
/* ------------------------------------------------------------------ */

#shqp-turnstile-widget {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    min-height: 0;
}

#shqp-turnstile-widget:empty {
    display: none;
}

/* ------------------------------------------------------------------ */
/* Verification sent state                                            */
/* ------------------------------------------------------------------ */

.trial-verification-sent {
    text-align: center;
    padding: 16px 0;
}

.trial-verification-sent .verification-icon {
    color: #3b82f6;
    margin-bottom: 16px;
}

.trial-verification-sent .verification-icon svg {
    width: 48px;
    height: 48px;
}

.trial-verification-sent h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px;
}

.trial-verification-sent p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px;
    line-height: 1.5;
}

.trial-verification-sent .verification-note {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.trial-resend-btn {
    display: inline-block;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trial-resend-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.trial-resend-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Responsive — 640px breakpoint (matches login modal)                */
/* ------------------------------------------------------------------ */

@media (max-width: 640px) {
    .trial-popup-container {
        padding: 24px;
        width: 95%;
        max-height: 95vh;
        overflow-y: auto;
    }

    .trial-popup-header h2 {
        font-size: 20px;
    }

    .trial-popup-sso {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sso-button {
        height: 48px;
    }
}

/* ------------------------------------------------------------------ */
/* Dark mode support                                                  */
/* ------------------------------------------------------------------ */

body.dark-mode .trial-popup-container,
body[class*="dark"] .trial-popup-container,
html.dark-mode .trial-popup-container,
html[class*="dark"] .trial-popup-container {
    background: #1f2937;
    color: #f9fafb;
}

body.dark-mode .trial-popup-header h2,
body[class*="dark"] .trial-popup-header h2,
html.dark-mode .trial-popup-header h2,
html[class*="dark"] .trial-popup-header h2 {
    color: #f9fafb;
}

body.dark-mode .trial-popup-header p,
body[class*="dark"] .trial-popup-header p,
html.dark-mode .trial-popup-header p,
html[class*="dark"] .trial-popup-header p {
    color: #9ca3af;
}

body.dark-mode .trial-popup-close,
body[class*="dark"] .trial-popup-close,
html.dark-mode .trial-popup-close,
html[class*="dark"] .trial-popup-close {
    color: #9ca3af;
}

body.dark-mode .trial-popup-close:hover,
body[class*="dark"] .trial-popup-close:hover,
html.dark-mode .trial-popup-close:hover,
html[class*="dark"] .trial-popup-close:hover {
    background: #374151;
    color: #f9fafb;
}

/* Plan badge — dark */
body.dark-mode .plan-badge,
body[class*="dark"] .plan-badge,
html.dark-mode .plan-badge,
html[class*="dark"] .plan-badge {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
}

body.dark-mode .plan-trial,
body[class*="dark"] .plan-trial,
html.dark-mode .plan-trial,
html[class*="dark"] .plan-trial {
    color: #9ca3af;
}

/* SSO buttons — dark */
body.dark-mode .sso-button,
body[class*="dark"] .sso-button,
html.dark-mode .sso-button,
html[class*="dark"] .sso-button {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .sso-button:hover,
body[class*="dark"] .sso-button:hover,
html.dark-mode .sso-button:hover,
html[class*="dark"] .sso-button:hover {
    background: #4b5563;
    border-color: #6b7280;
}

/* Separator — dark */
body.dark-mode .trial-popup-divider::before,
body[class*="dark"] .trial-popup-divider::before,
html.dark-mode .trial-popup-divider::before,
html[class*="dark"] .trial-popup-divider::before {
    background: #4b5563;
}

body.dark-mode .trial-popup-divider span,
body[class*="dark"] .trial-popup-divider span,
html.dark-mode .trial-popup-divider span,
html[class*="dark"] .trial-popup-divider span {
    background: #1f2937;
    color: #9ca3af;
}

/* Input — dark */
body.dark-mode .trial-popup-email-form input[type="email"],
body[class*="dark"] .trial-popup-email-form input[type="email"],
html.dark-mode .trial-popup-email-form input[type="email"],
html[class*="dark"] .trial-popup-email-form input[type="email"] {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .trial-popup-email-form input[type="email"]:focus,
body[class*="dark"] .trial-popup-email-form input[type="email"]:focus,
html.dark-mode .trial-popup-email-form input[type="email"]:focus,
html[class*="dark"] .trial-popup-email-form input[type="email"]:focus {
    border-color: #3b82f6;
}

body.dark-mode .trial-popup-email-form input[type="email"]::placeholder,
body[class*="dark"] .trial-popup-email-form input[type="email"]::placeholder,
html.dark-mode .trial-popup-email-form input[type="email"]::placeholder,
html[class*="dark"] .trial-popup-email-form input[type="email"]::placeholder {
    color: #6b7280;
}

/* Message — dark */
body.dark-mode .trial-email-message.success,
body[class*="dark"] .trial-email-message.success,
html.dark-mode .trial-email-message.success,
html[class*="dark"] .trial-email-message.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

body.dark-mode .trial-email-message.error,
body[class*="dark"] .trial-email-message.error,
html.dark-mode .trial-email-message.error,
html[class*="dark"] .trial-email-message.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Footer — dark */
body.dark-mode .trial-popup-footer,
body[class*="dark"] .trial-popup-footer,
html.dark-mode .trial-popup-footer,
html[class*="dark"] .trial-popup-footer {
    border-top-color: #4b5563;
}

body.dark-mode .trial-popup-footer p,
body[class*="dark"] .trial-popup-footer p,
html.dark-mode .trial-popup-footer p,
html[class*="dark"] .trial-popup-footer p {
    color: #9ca3af;
}

/* Verification sent — dark */
body.dark-mode .trial-verification-sent h3,
body[class*="dark"] .trial-verification-sent h3,
html.dark-mode .trial-verification-sent h3,
html[class*="dark"] .trial-verification-sent h3 {
    color: #f9fafb;
}

body.dark-mode .trial-verification-sent p,
body[class*="dark"] .trial-verification-sent p,
html.dark-mode .trial-verification-sent p,
html[class*="dark"] .trial-verification-sent p {
    color: #9ca3af;
}

body.dark-mode .trial-resend-btn,
body[class*="dark"] .trial-resend-btn,
html.dark-mode .trial-resend-btn,
html[class*="dark"] .trial-resend-btn {
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .trial-resend-btn:hover,
body[class*="dark"] .trial-resend-btn:hover,
html.dark-mode .trial-resend-btn:hover,
html[class*="dark"] .trial-resend-btn:hover {
    background: #374151;
    border-color: #6b7280;
}
