/* Character Page - Modal and CTA Button Styles */

.contact-login-gate {
    position: fixed;
    /* 쿠키 동의 배너(z-index 99999)가 게이트 CTA 를 덮지 않도록 최상위 배치 */
    z-index: 100001;
    inset: 0;
    display: grid;
    place-items: end center;
    padding: 18px;
    background: rgba(24, 18, 30, .56);
    backdrop-filter: blur(3px);
}

.contact-login-card {
    position: relative;
    width: min(100%, 420px);
    padding: 22px;
    border-radius: 22px;
    background: var(--bg-primary, #fff);
    box-shadow: 0 24px 80px rgba(17, 17, 17, .28);
    text-align: center;
}

.contact-login-card > img,
.contact-login-placeholder {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 10px;
    place-items: center;
    border-radius: 22px;
    background: color-mix(in srgb, var(--primary-color, #894DEB) 11%, #fff);
    object-fit: cover;
    color: var(--primary-color, #1e8a5e);
    font-size: 30px;
}

.contact-login-card small {
    color: var(--primary-color, #1e8a5e);
    font-size: 11px;
    font-weight: 800;
}

.contact-login-card h2 {
    margin: 5px 0 7px;
    color: var(--text-primary, #25212a);
    font-size: 20px;
    line-height: 1.3;
}

.contact-login-card p {
    margin: 0 0 17px;
    color: var(--text-secondary, #625b68);
    font-size: 13px;
    line-height: 1.5;
}

.contact-login-primary,
.contact-login-later {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.contact-login-primary {
    border: 1px solid var(--primary-color, #1e8a5e);
    background: var(--primary-color, #894DEB);
    color: #fff;
}

.contact-login-later {
    margin-top: 7px;
    border: 0;
    background: transparent;
    color: var(--text-secondary, #625b68);
}

.contact-login-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--background-secondary, #f5f2f7);
    color: var(--text-primary, #25212a);
    font-size: 21px;
    cursor: pointer;
}

@media (min-width: 560px) {
    .contact-login-gate { place-items: center; }
}

/* Override fixed-bottom-cta position to sit above bottom-nav.
   bottom-nav 은 모바일에서만 보이므로 데스크톱에서는 띄우지 않는다. */
@media (max-width: 767px) {
    .fixed-bottom-cta {
        bottom: 56px;
    }
}

.fixed-bottom-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.fixed-bottom-buttons .btn {
    flex: 1;
}

/* 마이크 권한 확인 중 (character-page-call.js) */
.btn.is-loading,
.btn:disabled {
    opacity: 0.6;
    cursor: progress;
    pointer-events: none;
    animation: none;
}

.btn-secondary-outline {
    background: var(--bg-primary, white);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.offline-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--background-secondary);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 15px;
    width: 100%;
}

.cta-buttons-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.cta-buttons-row .offline-notice {
    flex: 1;
}

.btn-chat-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(137, 77, 235, 0.3);
}

.btn-chat-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(30, 138, 94, 0.4);
}

/* Share modal */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 10000;
}

.share-modal-content {
    background: var(--card-bg, #fff);
    border-radius: 20px 20px 0 0;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slide-up 0.3s ease;
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.share-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.share-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: scale(1.05);
}

.share-btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn-label {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.share-link-box {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
    padding: 4px;
}

.share-link-input {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-primary, #333);
}

.share-link-copy {
    padding: 12px 16px;
    border: none;
    background: var(--primary, #6366f1);
    color: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* Full width button when online */
.btn-call-full {
    width: 100%;
    flex-direction: column;
    gap: 2px;
}

.btn-call-full .call-btn-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.call-btn-free-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 2px;
}

/* Online request button */
.btn-request-online {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), #7500EA);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-request-online:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 138, 94, 0.4);
}

.btn-request-online:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-request-online.sent {
    background: #6b7280;
}

/* Loading spin animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* In-app browser modal */
.inapp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.inapp-modal-content {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow, 0 10px 40px rgba(0, 0, 0, 0.3));
}

.inapp-modal-icon {
    margin-bottom: 16px;
}

.inapp-modal-content h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #1f1f1f);
    margin: 0 0 10px;
    line-height: 1.4;
}

.inapp-modal-content p {
    font-size: 13px;
    color: var(--text-secondary, #666);
    line-height: 1.6;
    margin: 0 0 20px;
}

.inapp-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.inapp-modal-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: var(--primary, #ff6b6b);
    color: #fff;
    transition: all 0.2s;
}

.inapp-modal-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.inapp-modal-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    cursor: pointer;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #333);
    transition: all 0.2s;
}

.inapp-modal-btn-secondary:hover {
    border-color: var(--primary, #ff6b6b);
    color: var(--primary, #ff6b6b);
}

.inapp-modal-hint {
    font-size: 11px !important;
    color: var(--text-light, #999) !important;
    margin: 0 0 16px !important;
}

.inapp-modal-close {
    background: none;
    border: none;
    color: var(--text-light, #888);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 12px;
}

.inapp-modal-close:hover {
    color: var(--text-primary, #333);
}

/* Mobile Responsive Styles */
@media (max-width: 480px) {
    .btn-request-online {
        padding: 10px 12px;
        font-size: 12px;
    }

    .offline-notice {
        padding: 12px 16px;
        font-size: 14px;
    }

    .share-modal-content {
        padding: 20px 16px;
        border-radius: 16px 16px 0 0;
    }

    .share-buttons {
        gap: 12px;
    }

    .share-btn-icon {
        width: 44px;
        height: 44px;
    }

    .share-btn-label {
        font-size: 11px;
    }

    .inapp-modal-content {
        padding: 24px 20px;
        max-width: 300px;
    }

    .inapp-modal-content h3 {
        font-size: 16px;
    }

    .inapp-modal-content p {
        font-size: 12px;
    }

    .inapp-modal-btn-primary {
        padding: 12px 16px;
        font-size: 13px;
    }

    .inapp-modal-btn-secondary {
        padding: 10px 16px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .btn-request-online {
        flex: 1;
    }

    .share-buttons {
        grid-template-columns: repeat(3, 1fr);
    }

    .share-btn-icon {
        width: 40px;
        height: 40px;
    }

    .inapp-modal-content {
        margin: 0 10px;
    }
}

/* ===== Free Text Request Section ===== */
.request-free-text-section {
    margin-top: 16px;
}

.request-section-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 16px 0;
    color: var(--text-muted, #666);
    font-size: 13px;
}

.request-section-divider::before,
.request-section-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border, #e0e0e0);
}

.request-section-divider span {
    padding: 0 12px;
}

.request-free-text-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.request-free-text-input:focus {
    outline: none;
    border-color: var(--primary, #6ec5b8);
    box-shadow: 0 0 0 3px rgba(110, 197, 184, 0.1);
}

.request-free-text-input::placeholder {
    color: var(--text-muted, #999);
}

.request-free-text-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted, #999);
    margin-top: 4px;
}

.request-free-text-price-info {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
}

.request-summary-total {
    font-weight: 600;
    color: var(--primary, #6ec5b8);
}

/* ========== Dark Mode Overrides ========== */
[data-theme="dark"] .request-free-text-input {
    background: var(--bg-secondary);
    color: var(--text);
}

[data-theme="dark"] .inapp-modal-content {
    border: 1px solid var(--border-color);
}
