/**
 * AI Bridge Newsletter Popup - Frontend Styles
 */

/* オーバーレイ */
.abnl-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

.abnl-overlay.abnl-active {
    display: flex;
}

/* ポップアップ共通 */
.abnl-popup {
    background-color: var(--abnl-bg, #ffffff);
    color: var(--abnl-text, #333333);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    padding: 40px 36px 30px;
    text-align: center;
    position: relative;
    max-width: 440px;
    width: 90%;
    animation: abnl-fadeIn 0.3s ease;
    box-sizing: border-box;
}

/* 位置: 中央（モーダル） */
.abnl-position-center {
    /* flexbox center by overlay */
}

/* 位置: 右下（スライドイン） */
.abnl-position-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 380px;
    animation: abnl-slideInRight 0.4s ease;
}

/* 位置: 左下（スライドイン） */
.abnl-position-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 380px;
    animation: abnl-slideInLeft 0.4s ease;
}

/* スライドイン時はオーバーレイを透過 */
.abnl-overlay:has(.abnl-position-bottom-right),
.abnl-overlay:has(.abnl-position-bottom-left) {
    background-color: transparent !important;
    pointer-events: none;
}

.abnl-overlay:has(.abnl-position-bottom-right) .abnl-popup,
.abnl-overlay:has(.abnl-position-bottom-left) .abnl-popup {
    pointer-events: auto;
}

/* 閉じるボタン */
.abnl-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.abnl-close:hover {
    color: #333;
}

/* アイコン */
.abnl-icon {
    font-size: 48px;
    color: var(--abnl-primary, #2E6BB5);
    margin-bottom: 8px;
    line-height: 1;
}

/* 見出し */
.abnl-heading {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    color: inherit;
    line-height: 1.4;
}

/* 説明文 */
.abnl-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px;
    line-height: 1.6;
}

/* フォーム */
.abnl-form {
    margin: 0;
}

.abnl-input-group {
    display: flex;
    gap: 8px;
    max-width: 360px;
    margin: 0 auto;
}

.abnl-email {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
    background: #fff;
    box-sizing: border-box;
}

.abnl-email:focus {
    border-color: var(--abnl-primary, #2E6BB5);
}

.abnl-submit {
    padding: 12px 24px;
    background-color: var(--abnl-primary, #2E6BB5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
}

.abnl-submit:hover {
    opacity: 0.9;
}

.abnl-submit:active {
    transform: scale(0.97);
}

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

/* ハニーポット（非表示） */
.abnl-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

/* メッセージ */
.abnl-message {
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

.abnl-message-success {
    color: #46b450;
    font-weight: 600;
}

.abnl-message-error {
    color: #dc3232;
}

/* プライバシー注記 */
.abnl-privacy {
    font-size: 11px;
    color: #999;
    margin: 14px 0 0;
}

/* 送信中スピナー */
.abnl-submit.abnl-loading {
    position: relative;
    color: transparent;
}

.abnl-submit.abnl-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: abnl-spin 0.6s linear infinite;
}

/* アニメーション */
@keyframes abnl-fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes abnl-slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes abnl-slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes abnl-spin {
    to { transform: rotate(360deg); }
}

/* フェードアウト */
.abnl-overlay.abnl-closing {
    animation: abnl-fadeOut 0.2s ease forwards;
}

.abnl-overlay.abnl-closing .abnl-popup {
    animation: abnl-popOut 0.2s ease forwards;
}

@keyframes abnl-fadeOut {
    to { opacity: 0; }
}

@keyframes abnl-popOut {
    to { opacity: 0; transform: scale(0.95); }
}

/* モバイル */
@media (max-width: 768px) {
    .abnl-popup {
        padding: 30px 24px 24px;
        max-width: 94%;
        border-radius: 12px;
    }

    .abnl-position-bottom-right,
    .abnl-position-bottom-left {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }

    .abnl-input-group {
        flex-direction: column;
    }

    .abnl-submit {
        width: 100%;
    }

    .abnl-heading {
        font-size: 18px;
    }

    .abnl-icon {
        font-size: 36px;
    }
}
