/* =============================================
   인증 공통 스타일
   모달 오버레이, 폼 공통 요소, 헤더 인증 버튼
   ============================================= */

/* 오버레이 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 30, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* 기본: 숨김 상태 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* 모달 박스 */
.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px 36px 36px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.28s ease;
}
.modal-overlay.is-open .modal-box {
    transform: translateY(0) scale(1);
}

/* 모달 헤더 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--light-bg);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* 폼 그룹 */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}
.form-label .required { color: #e74c3c; margin-left: 2px; }

/* 인풋 공통 */
.form-input, .form-select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26, 107, 154, 0.12);
}
.form-input.is-error, .form-select.is-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* 에러 메시지 */
.form-error {
    display: block;
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
    min-height: 16px;
}

/* 전송 결과 메시지 */
.form-msg {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.form-msg.success { background: #eafaf1; color: #1e8449; border: 1px solid #a9dfbf; }
.form-msg.error   { background: #fdf2f2; color: #c0392b; border: 1px solid #f1aeb5; }

/* 제출 버튼 */
.btn-submit {
    width: 100%;
    height: 48px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 6px;
}
.btn-submit:hover  { background: var(--primary-light); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* 헤더 버튼을 <a>와 동일하게 */
.header-auth .btn-auth[type="button"] {
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.header-auth .btn-auth.signup[type="button"] {
    background: var(--accent);
    color: #fff;
}
.header-auth .btn-auth.signup[type="button"]:hover { background: var(--accent-hover); }
.header-auth .btn-auth.login[type="button"] {
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.25);
    background: transparent;
}
.header-auth .btn-auth.login[type="button"]:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* 로그인 후 헤더 영역 */
.user-greeting {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
}
.btn-auth.logout {
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-auth.logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* 모달 반응형 */
@media (max-width: 520px) {
    .modal-box { padding: 28px 20px 24px; }
}
