/* ==================== */
/* Login Page Base Styles */
/* ==================== */

/* ========================================
   Login Page Styles
======================================== */

/* 전역 CSS 오버라이드 - 로그인 페이지 격리 */
.login-page * {
    color: inherit;
}

/* 헤더 좌측 하단 border-radius 바깥쪽 빈 공간 채우기 제거 */
.login-page::before {
    display: none !important;
}

.login-page {
    min-height: 100vh;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: #181818 !important;
}

.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    position: relative;
}

/* 상단 왼쪽 뒤로가기 버튼 */
.btn-back-top {
    position: absolute;
    top: 24px;
    left: 24px;
    background: var(--color-primary);
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--color-white) !important;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(74, 111, 217, 0.25);
    transition: all 0.2s ease;
    z-index: 100;
}

.btn-back-top:hover {
    background: #3a5bc4;
    box-shadow: 0 4px 12px rgba(74, 111, 217, 0.35);
    transform: translateY(-1px);
}

.btn-back-top:active {
    transform: translateY(0);
}

.btn-back-top svg {
    flex-shrink: 0;
}

.btn-back-top span {
    white-space: nowrap;
}

/* 중앙 로그인 폼 영역 */
.login-form-wrapper {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.login-box {
    padding: 48px 32px;
    width: 100%;
    background: var(--color-white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-title {
    font-size: 25px;
    font-weight: 700;
    color: var(--color-text-primary) !important;
    text-align: center;
    margin: 0 0 40px 0;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

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

.form-input {
    width: 100%;
    height: 50px;
    padding: 0 var(--spacing-md);
    border: 1px solid #E0E0E0;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary) !important;
    transition: all 0.3s ease;
    background-color: #FAFAFA !important;
}

.form-input::placeholder {
    color: #BDBDBD;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary-blue);
    box-shadow: 0 0 0 3px rgba(9, 81, 243, 0.1);
    background-color: var(--color-white);
    transform: translateY(-1px);
}

.form-input.error {
    border-color: #E53E3E;
    background-color: #FFF5F5;
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.form-error-message {
    display: none;
    font-size: var(--font-size-xs);
    color: #E53E3E;
    margin-top: 6px;
    padding-left: 4px;
}

.form-group.has-error .form-error-message {
    display: block;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Password Wrapper */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #757575;
    font-size: 18px;
    border-radius: var(--border-radius-sm);
    transition: background-color 0.2s, color 0.2s;
}

.btn-toggle-password:hover {
    background-color: #F5F5F5;
    color: var(--color-text-primary);
}

/* Login Button */
.login-form .btn-login {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--color-white);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-form .btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.login-form .btn-login:hover::before {
    left: 100%;
}

.login-form .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.login-form .btn-login:active {
    transform: translateY(0) scale(0.98);
}

.login-form .btn-login:disabled {
    background: #E5E7EB;
    color: var(--color-text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.login-form .btn-login.loading {
    pointer-events: none;
}

.login-form .btn-login.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Signup Button */
.btn-signup {
    width: 100%;
    height: 52px;
    color: var(--color-primary-blue);
    border: 2px solid var(--color-primary-blue);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: var(--spacing-lg);
    transition: all 0.3s ease;
    background-color: transparent;
}

.btn-signup:hover {
    background-color: var(--color-primary-blue);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(9, 81, 243, 0.3);
}

.btn-signup:active {
    transform: translateY(0) scale(0.98);
}

/* Forgot Password Link */
.link-forgot-password {
    display: block;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: color 0.2s;
}

.link-forgot-password:hover {
    color: var(--color-primary-blue);
    text-decoration: underline;
}

/* ==================== */
/* 비밀번호 찾기 모달 */
/* ==================== */
.password-reset-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    /* stacking: modal < loading < alert */
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.password-reset-modal {
    background-color: var(--color-white);
    border-radius: var(--border-radius-md);
    padding: 40px 32px 32px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: 20px;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 50%;
}

.modal-close-btn:hover {
    color: var(--color-text-primary);
    background-color: #F5F5F5;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #333333 !important;
    margin: 0 0 8px 0;
    line-height: 22.5px;
    text-align: center;
}

.modal-description {
    margin: 0 0 20px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text-tertiary);
    text-align: center;
}

/* 방법 선택 탭 */
.reset-method-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background-color: #F5F5F5;
    border-radius: var(--border-radius-md);
    padding: 4px;
}

.reset-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.reset-tab-btn i {
    font-size: 16px;
}

.reset-tab-btn.active {
    background-color: var(--color-white);
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.reset-tab-btn:hover:not(.active) {
    color: var(--color-text-primary);
    background-color: rgba(255, 255, 255, 0.5);
}

.reset-method-content {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reset-phone-step2 {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-summary {
    padding: 10px 12px;
    border-radius: 10px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.modal-summary-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.modal-summary-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-primary);
}

.modal-summary-note {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.modal-summary-copy-btn {
    border: none;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background-color: #EEF2FF;
    color: #4338CA;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.modal-summary-copy-btn:hover {
    background-color: #E0E7FF;
}

.modal-summary-copy-btn:active {
    transform: scale(0.96);
}

.modal-btn-primary {
    width: 100%;
    height: 48px;
    border-radius: var(--border-radius-md);
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.modal-btn-primary:hover {
    background-color: #3B5DC1;
}

.modal-btn-primary:active {
    transform: scale(0.98);
}

.modal-input-group {
    display: flex;
    gap: 8px;
}

.modal-input {
    width: 100%;
    height: 48px;
    padding: 12px;
    font-size: 14px;
    color: var(--color-text-primary) !important;
    background-color: var(--color-white) !important;
    border: 0.667px solid #E5E7EB;
    border-radius: var(--border-radius-md);
    transition: border-color 0.2s;
}

.modal-input::placeholder {
    color: var(--color-text-tertiary);
}

.modal-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.modal-input:disabled {
    background-color: #F5F5F5;
    color: var(--color-text-tertiary);
}

.modal-btn-verify {
    width: 85.656px;
    height: 48px;
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--border-radius-md);
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.modal-btn-verify:hover {
    background-color: #3B5DC1;
}

.modal-btn-verify:disabled {
    background-color: #E5E7EB;
    color: var(--color-text-tertiary);
}

.modal-verification-wrapper {
    position: relative;
    flex: 1;
}

.modal-verification-wrapper .modal-input {
    padding-right: 60px;
}

.modal-timer {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 500;
    color: #E53E3E;
    line-height: 18px;
}

.modal-btn-verify-confirm {
    width: 85.66px;
    height: 48px;
    background-color: #F5F5F5;
    color: var(--color-text-tertiary);
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--border-radius-md);
    flex-shrink: 0;
    transition: background-color 0.2s, color 0.2s;
}

.modal-btn-verify-confirm:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.modal-btn-verify-confirm:not(:disabled):hover {
    background-color: #3B5DC1;
}

.modal-help-text {
    font-size: 12px;
    color: var(--color-text-gray);
    line-height: 18px;
    margin: -2px 0 0 10px;
}

.modal-help-text--highlight {
    margin-top: 8px;
    margin-left: 2px;
    color: var(--color-text-primary);
    animation: modalHelpFadeIn 0.3s ease-out;
}

@keyframes modalHelpFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-input-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 6px;
    padding: 0 4px;
}

.modal-length {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    line-height: 16px;
}

.modal-length.length-warning {
    color: #d97706; /* amber-600 */
}

.modal-length.length-ok {
    color: #16a34a; /* green-600 */
}

.modal-btn-submit {
    width: 100%;
    height: 54px;
    background-color: #F5F5F5;
    color: var(--color-text-tertiary);
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--border-radius-md);
    margin-top: 16px;
    transition: background-color 0.2s, color 0.2s, transform 0.1s;
    cursor: not-allowed;
}

.modal-btn-submit:disabled {
    background-color: #F5F5F5;
    color: var(--color-text-tertiary);
    cursor: not-allowed;
}

.modal-btn-submit.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    cursor: pointer;
}

.modal-btn-submit.active:hover {
    background-color: #3B5DC1;
}

.modal-btn-submit.active:active {
    transform: scale(0.98);
}

/* Responsive - 비밀번호 찾기 모달 */
@media (max-width: 768px) {
    .password-reset-modal {
        padding: 32px 24px 24px;
        max-width: 90%;
    }
    
    .reset-method-tabs {
        gap: 4px;
        padding: 3px;
    }
    
    .reset-tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .reset-tab-btn i {
        font-size: 14px;
    }
    
    .reset-tab-btn span {
        display: none;
    }
    
    @media (min-width: 481px) {
        .reset-tab-btn span {
            display: inline;
        }
    }
}

@media (max-width: 480px) {
    .password-reset-modal {
        padding: 28px 20px 20px;
        max-width: 95%;
        border-radius: 16px;
    }

    .modal-title {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    .reset-method-tabs {
        margin-bottom: 20px;
    }

    .modal-input {
        height: 44px;
        font-size: 13px;
    }

    .modal-btn-verify,
    .modal-btn-verify-confirm {
        width: 75px;
        height: 44px;
        font-size: 13px;
    }

    .modal-btn-submit {
        height: 50px;
        font-size: 15px;
    }

    .modal-help-text {
        font-size: 11px;
    }
}

/* ========================================
   Alert Popup (로그인 페이지용)
======================================== */

.alert-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 22000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.alert-popup {
    background-color: var(--color-white);
    border-radius: var(--border-radius-lg);
    padding: 32px 28px 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: alertSlideIn 0.3s ease-out;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: 20px;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 50%;
}

.alert-close-btn:hover {
    color: var(--color-text-primary);
    background-color: #F5F5F5;
}

.alert-content {
    padding: 8px 0 28px;
    text-align: center;
}

.alert-message {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--color-text-primary) !important;
    line-height: 1.6;
    margin: 0;
    word-break: keep-all;
}

.alert-buttons {
    display: flex;
    gap: 12px;
}

.alert-confirm-btn {
    flex: 1;
    height: 52px;
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: var(--font-size-md);
    font-weight: 600;
    border-radius: var(--border-radius-md);
    transition: background-color 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
}

.alert-confirm-btn:hover {
    background-color: #3B5DC1;
}

.alert-confirm-btn:active {
    transform: scale(0.98);
}

.alert-cancel-btn {
    flex: 1;
    height: 52px;
    background-color: #F5F5F5;
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
    font-weight: 600;
    border-radius: var(--border-radius-md);
    transition: background-color 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
}

.alert-cancel-btn:hover {
    background-color: #E0E0E0;
}

.alert-cancel-btn:active {
    transform: scale(0.98);
}

@media (max-width: 480px) {
    .alert-popup {
        padding: 28px 24px 20px;
        max-width: 340px;
    }

    .alert-content {
        padding: 4px 0 24px;
    }

    .alert-message {
        font-size: var(--font-size-md);
    }

    .alert-confirm-btn,
    .alert-cancel-btn {
        height: 48px;
        font-size: var(--font-size-sm);
    }
    
    .alert-buttons {
        gap: 8px;
    }
}

/* Responsive - Login Page */
@media (max-width: 768px) {
    .btn-back-top {
        top: 16px;
        left: 16px;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .login-container {
        padding: var(--spacing-md);
    }
    
    .login-form-wrapper {
        width: 100%;
        max-width: 100%;
    }
    
    .login-box {
        padding: 40px 28px;
    }

    .login-title {
        font-size: 24px;
        margin-bottom: 32px;
    }

    .form-input,
    .login-form .btn-login,
    .btn-signup {
        height: 48px;
    }
}

/* 로딩 오버레이 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 21000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

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

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 성공 애니메이션 */
@keyframes successCheck {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 반응형 개선 */
@media (max-width: 768px) {
    .login-page {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    .login-box {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: var(--spacing-md);
    }

    .login-box {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 22px;
        margin-bottom: 28px;
    }

    .form-input,
    .login-form .btn-login,
    .btn-signup {
        height: 44px;
        font-size: var(--font-size-md);
    }
    
    .btn-back-top {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .btn-back-top span {
        display: none;
    }
}


