/* ========================================
   인증 관련 모달 스타일 (로그인/회원가입/약관/프로필)
   ======================================== */

/* 인증 모달 기본 컨테이너 */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* ===== 로그인 모달 스타일 ===== */
.login-modal-content {
    position: relative;
    max-width: 440px;
    width: 90%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease-out;
    transform: translateY(0);
}

.login-header {
    padding: 32px 32px 24px;
    background: white;
    color: var(--text-primary);
    text-align: center;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.login-title .keywork-brand {
    color: var(--brand-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

.login-body {
    padding: 0 32px 32px;
}

/* 로그인 닫기 버튼 */
.login-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.login-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
    transform: scale(1.1);
}

/* ===== 회원가입 모달 스타일 ===== */
.signup-modal-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.signup-header {
    padding: 32px 32px 24px;
    background: white;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.signup-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--brand-primary);
}

.signup-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.signup-body {
    padding: 24px 32px 32px;
    max-height: calc(90vh - 150px);
    overflow-y: auto;
}

/* 회원가입 단계별 섹션 */
.signup-step {
    padding: 24px 32px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.signup-step .form-group {
    margin-bottom: 20px;
}

.signup-step .form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.signup-step .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.signup-step .form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(20, 40, 160, 0.1);
}

/* 버튼 그룹 */
.signup-step .btn-group {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding: 20px 0 0 0;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0; /* 버튼 영역은 줄어들지 않도록 */
}

.signup-step .btn {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: var(--text-primary);
}

.signup-step .btn.primary {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.signup-step .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.signup-step .btn.primary:hover {
    background: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

.signup-step .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 회원가입 닫기 버튼 */
.signup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.signup-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
    transform: scale(1.1);
}

/* ===== 공통 탭 스타일 ===== */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.auth-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
}

.auth-tab.active {
    color: #1428A0;
    border-bottom-color: #1428A0;
    font-weight: bold;
}

.auth-tab:hover {
    color: #1428A0;
}

/* ===== 폼 스타일 ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"] {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    background: white;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(20, 40, 160, 0.1);
}

.auth-form input.error {
    border-color: #dc3545;
}

.auth-form input.success {
    border-color: #28a745;
}

/* 제출 버튼 */
.auth-submit-btn {
    padding: 14px 20px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.auth-submit-btn:hover {
    background: var(--brand-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 40, 160, 0.3);
}

.auth-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 사용자 유형 선택기 ===== */
.user-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.user-type-option {
    padding: 30px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.user-type-option:hover {
    border-color: var(--brand-primary);
    background: rgba(20, 40, 160, 0.02);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.user-type-option.selected {
    border-color: var(--brand-primary);
    background: rgba(20, 40, 160, 0.05);
    box-shadow: 0 0 0 3px rgba(20, 40, 160, 0.1);
}

.user-type-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.user-type-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.user-type-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== 진행 단계 표시 ===== */
.signup-progress {
    padding: 20px 32px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 16px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--brand-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-steps .step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 0 10px;
}

.progress-steps .step.active {
    color: var(--brand-primary);
    font-weight: 600;
}

.progress-steps .step.completed {
    color: var(--success);
}

/* ===== 에러/성공 메시지 ===== */
.auth-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin: 16px 0;
    display: none;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
    display: block;
}

.auth-message.success {
    background: #d1e7dd;
    color: #0a3622;
    border: 1px solid #a3cfbb;
    display: block;
}

/* ===== 닉네임/ID 중복 확인 ===== */
.nickname-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.nickname-input-group .form-input {
    flex: 1;
    min-width: 0; /* flexbox에서 입력창이 줄어들 수 있도록 */
}

.verify-btn {
    padding: 12px 16px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 100px; /* 최소 너비 증가 */
    max-width: 130px; /* 최대 너비 증가 */
}

.verify-btn:hover {
    background: var(--brand-secondary);
    transform: translateY(-1px);
}

.verify-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 생년월일 입력 그룹 */
.birthdate-input-group {
    position: relative;
}

.birthdate-input {
    width: 100%;
}

.birthdate-hint {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* 전화번호 인증 */
.phone-verify-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.phone-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.phone-input-group .form-input,
.phone-input-group input[type="tel"] {
    flex: 1;
    min-width: 0;
}

.phone-verification {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.verify-code-input {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: stretch;
}

.verify-code-input .form-input {
    flex: 1;
    min-width: 0;
}

.sms-help-text {
    padding: 12px 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    line-height: 1.5;
}

/* 약관 동의 */
.terms-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.terms-container label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
}

.terms-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-link {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-link:hover {
    color: var(--brand-secondary);
}

/* ===== 약관 모달 스타일 ===== */
.modal-content {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    padding: 32px;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease-out;
}

.modal-content.modal-large {
    max-width: 700px;
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    background: white;
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
    transform: scale(1.1);
}

/* 약관 탭 */
.terms-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e7eb;
}

.terms-tab {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.terms-tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.terms-tab:hover {
    color: var(--brand-primary);
}

.terms-content {
    padding: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== 프로필 모달 스타일 ===== */
.profile-modal-content {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 0;
}

.info-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.info-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.info-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.profile-actions .btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-actions .btn.danger {
    background: #ef4444;
    color: white;
}

.profile-actions .btn.danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ===== 애니메이션 ===== */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== 계정관리 메뉴 스타일 ===== */
.account-menu-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.account-menu-item:hover {
    background: #f8fafc;
    border-color: var(--brand-primary);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(20, 40, 160, 0.1);
}

.account-menu-item .menu-icon {
    font-size: 24px;
    margin-right: 16px;
    min-width: 32px;
    text-align: center;
}

.account-menu-item .menu-text {
    flex: 1;
}

.account-menu-item .menu-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.account-menu-item .menu-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.account-menu-item .menu-arrow {
    font-size: 18px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

.account-menu-item:hover .menu-arrow {
    color: var(--brand-primary);
    transform: translateX(2px);
}

/* ===== 반응형 디자인 ===== */
@media (max-width: 768px) {
    .login-modal-content {
        width: 95%;
        max-width: 380px;
    }
    
    .login-header {
        padding: 24px 20px 20px;
    }
    
    .login-title {
        font-size: 24px;
    }
    
    .login-body {
        padding: 0 20px 24px;
    }
    
    .signup-modal-content {
        width: 95%;
        max-width: 500px;
        max-height: 90vh;
    }
    
    .signup-header {
        padding: 20px;
    }
    
    .signup-step {
        padding: 16px 20px;
        gap: 12px;
    }
    
    .verify-btn {
        min-width: 85px;
        max-width: 110px;
        font-size: 12px;
        padding: 12px 10px;
    }
    
    .user-type-selector {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .progress-steps {
        font-size: 0.7rem;
        flex-wrap: wrap;
    }
    
    .progress-steps .step {
        flex: 1;
        text-align: center;
        padding: 0 0.5rem;
    }
}

/* ===== 독립적인 프로필 편집 모달 스타일 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.modal .form-group input,
.modal .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background: white;
    box-sizing: border-box;
}

.modal .form-group input:focus,
.modal .form-group select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(20, 40, 160, 0.1);
}

.modal .form-help {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modal .modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.modal .modal-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .modal-btn.secondary {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
}

.modal .modal-btn.secondary:hover {
    background: #e5e7eb;
}

.modal .modal-btn.primary {
    background: var(--brand-primary);
    color: white;
}

.modal .modal-btn.primary:hover {
    background: var(--brand-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(20, 40, 160, 0.2);
}

/* ===== 비밀번호 강도 표시 스타일 ===== */
.password-strength {
    margin-top: 8px;
    padding: 8px 0;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 비밀번호 변경 모달 전용 스타일 */
#password-change-modal .form-group {
    margin-bottom: 20px;
}

#password-change-modal .form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

#password-change-modal input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(20, 40, 160, 0.1);
}

/* 비밀번호 확인 필드 상태별 스타일 */
#password-change-modal #new-password-confirm.valid {
    border-color: #10B981;
}

#password-change-modal #new-password-confirm.invalid {
    border-color: #EF4444;
}

/* 데스크톱 확장 */
@media (min-width: 1024px) {
    .login-modal-content {
        max-width: 450px;
    }
    
    .login-header {
        padding: 40px 40px 28px;
    }
    
    .login-title {
        font-size: 32px;
    }
    
    .login-body {
        padding: 0 40px 40px;
    }
    
    .signup-modal-content {
        max-width: 650px;
    }
}