/* ==========================================================================
   KEYWORK v4 - Content Gate (비회원 콘텐츠 제한)
   구인글 게시판 전용 — 블러 처리 + 가입유도 모달
   ========================================================================== */

/* ========== 콘텐츠 블러 처리 ========== */

.content-gated {
    position: relative;
    max-height: 300px;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.content-gated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.7) 40%,
        rgba(255, 255, 255, 0.95) 70%,
        rgba(255, 255, 255, 1) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.content-gated * {
    filter: blur(6px);
    -webkit-filter: blur(6px);
}

/* 다크모드 블러 그라데이션 */
[data-theme="dark"] .content-gated::after {
    background: linear-gradient(
        to bottom,
        rgba(26, 26, 26, 0) 0%,
        rgba(26, 26, 26, 0.7) 40%,
        rgba(26, 26, 26, 0.95) 70%,
        rgba(26, 26, 26, 1) 100%
    );
}

/* 원문보기 링크 숨김 */
.gate-hide-origin {
    display: none !important;
}

/* ========== 게이트 모달 백드롭 ========== */

.gate-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gate-backdrop.active {
    display: block;
    opacity: 1;
}

/* ========== 게이트 모달 ========== */

.gate-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 10001;
    width: 92%;
    max-width: 400px;
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.gate-modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 모달 닫기 버튼 */
.gate-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-tertiary, #f1f5f9);
    color: var(--text-tertiary, #64748b);
    border-radius: var(--radius-full, 9999px);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast, 150ms ease);
    z-index: 1;
}

.gate-modal__close:hover {
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
}

/* 잠김 모달에서는 닫기 숨김 */
.gate-modal--locked .gate-modal__close {
    display: none;
}

/* 모달 상단 아이콘 영역 */
.gate-modal__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 24px 0;
}

.gate-modal__icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* 안내 모달 (1~3회) 아이콘 */
.gate-modal--info .gate-modal__icon-circle {
    background: var(--color-primary-50, #eff6ff);
    color: var(--color-primary-500, #2563eb);
}

/* 잠김 모달 (4회+) 아이콘 */
.gate-modal--locked .gate-modal__icon-circle {
    background: #FEF2F2;
    color: var(--color-error, #ef4444);
}

/* 모달 본문 */
.gate-modal__body {
    padding: 20px 24px 8px;
    text-align: center;
}

.gate-modal__title {
    font-size: var(--font-size-lg, 18px);
    font-weight: var(--font-weight-bold, 700);
    color: var(--text-primary, #1e293b);
    margin: 0 0 8px;
    line-height: 1.4;
}

.gate-modal__desc {
    font-size: var(--font-size-sm, 14px);
    color: var(--text-secondary, #475569);
    margin: 0;
    line-height: 1.6;
}

.gate-modal__count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 14px;
    background: var(--color-primary-50, #eff6ff);
    color: var(--color-primary-500, #2563eb);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--font-size-xs, 12px);
    font-weight: var(--font-weight-semibold, 600);
}

.gate-modal--locked .gate-modal__count {
    background: #FEF2F2;
    color: var(--color-error, #ef4444);
}

/* ========== 모달 로그인/가입 섹션 ========== */

.gate-modal__actions {
    padding: 16px 24px 24px;
}

/* 구분선 */
.gate-modal__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
}

.gate-modal__divider::before,
.gate-modal__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #e2e8f0);
}

.gate-modal__divider span {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
}

/* OAuth 소셜 버튼 */
.gate-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: opacity var(--transition-fast, 150ms ease);
}

.gate-oauth-btn:hover {
    opacity: 0.9;
}

.gate-oauth-btn--naver {
    background: #03C75A;
    color: #fff;
    margin-bottom: 8px;
}

.gate-oauth-btn--kakao {
    background: #FEE500;
    color: #3C1E1E;
    margin-bottom: 12px;
}

/* 일반 회원가입 버튼 */
.gate-signup-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition-fast, 150ms ease);
}

.gate-signup-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* 하단 안내 */
.gate-modal__footer {
    text-align: center;
    padding: 0 24px 20px;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
}

.gate-modal__footer a {
    color: var(--color-primary-500, #2563eb);
    font-weight: 600;
    text-decoration: none;
}

.gate-modal__footer a:hover {
    text-decoration: underline;
}

/* 카운트다운 닫기 텍스트 */
.gate-modal__countdown {
    text-align: center;
    padding: 0 24px 16px;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    cursor: default;
}

.gate-modal__countdown-btn {
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
    cursor: default;
    padding: 0;
}

.gate-modal__countdown-btn.clickable {
    cursor: pointer;
    color: var(--text-tertiary, #64748b);
    text-decoration: underline;
}

.gate-modal__countdown-btn.clickable:hover {
    color: var(--text-secondary, #475569);
}

/* ========== 다크모드 ========== */

[data-theme="dark"] .gate-modal {
    background: var(--bg-primary, #1a1a1a);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .gate-modal__close {
    background: var(--bg-tertiary, #2d2d2d);
    color: var(--text-tertiary, #a3a3a3);
}

[data-theme="dark"] .gate-modal--info .gate-modal__icon-circle {
    background: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .gate-modal--locked .gate-modal__icon-circle {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .gate-modal__count {
    background: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .gate-modal--locked .gate-modal__count {
    background: rgba(239, 68, 68, 0.15);
}

/* ========== 반응형 ========== */

@media (max-width: 640px) {
    .gate-modal {
        width: 94%;
        max-width: none;
        margin: 0 auto;
    }

    .gate-modal__icon {
        padding: 24px 20px 0;
    }

    .gate-modal__body {
        padding: 16px 20px 8px;
    }

    .gate-modal__actions {
        padding: 12px 20px 20px;
    }

    .gate-modal__title {
        font-size: 17px;
    }

    .gate-oauth-btn,
    .gate-signup-btn {
        padding: 12px;
        font-size: 14px;
    }
}
