/* 전역 리셋 및 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff0038;
    --primary-hover: #cc002d;
    --primary-light: rgba(255, 0, 56, 0.1);
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border-color: #ddd;
    --background: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --error-color: #ff4444;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #e8e8e8 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 로그인 컨테이너 */
.login-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

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

/* 로그인 박스 */
.login-box {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px 30px;
    transition: var(--transition);
}

.login-box:hover {
    box-shadow: var(--shadow-hover);
}

/* 로고 섹션 */
.logo-section {
    text-align: center;
    margin-bottom: 40px;
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 폼 스타일 */
.login-form {
    margin-bottom: 30px;
}

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

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

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-light);
}

/* 자동 로그인 체크박스 */
.auto-login-group {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

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

/* 에러 메시지 */
.error-message {
    display: none;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 8px;
    color: var(--error-color);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.error-message.show {
    display: block;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 로그인 버튼 */
.btn-login {
    width: 100%;
    height: 52px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-login:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 56, 0.3);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-text {
    transition: opacity 0.3s;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login.loading .btn-spinner {
    display: inline-block !important;
    position: absolute;
}

/* 스피너 애니메이션 */
.spinner {
    animation: rotate 2s linear infinite;
    width: 24px;
    height: 24px;
}

.spinner .path {
    stroke: var(--white);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* 푸터 */
.login-footer {
    text-align: center;
    margin-top: 24px;
}

.copyright {
    font-size: 12px;
    color: var(--text-light);
}

/* 반응형 디자인 - 모바일 */
@media screen and (max-width: 480px) {
    body {
        padding: 16px;
    }

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

    .logo-text {
        font-size: 28px;
    }

    .logo-subtitle {
        font-size: 13px;
    }

    .form-input {
        height: 46px;
        font-size: 16px; /* iOS zoom 방지 */
    }

    .btn-login {
        height: 50px;
    }
}

/* 태블릿 */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .login-container {
        max-width: 480px;
    }

    .login-box {
        padding: 36px 28px;
    }
}

/* 데스크톱 */
@media screen and (min-width: 769px) {
    .login-container {
        max-width: 440px;
    }

    .login-box {
        padding: 44px 32px;
    }
}

/* 다크모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-light: #888;
        --border-color: #444;
        --background: #1a1a1a;
        --white: #2a2a2a;
    }

    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .btn-login:hover {
        transform: none;
    }

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

/* 포커스 접근성 */
.form-input:focus-visible,
.btn-login:focus-visible,
.checkbox-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}