/**
 * YTK-Note 인증 UI 스타일 (Forbes Money 디자인)
 * auth-service v2 연동을 위한 현대적이고 깔끔한 인증 인터페이스
 */

/* 인증 네비게이션 스타일 */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: white;
}

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

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* 사용자 메뉴 스타일 */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.user-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 80px;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.dropdown-arrow {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.user-btn:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* 드롭다운 메뉴 */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.logout {
    color: #dc3545;
}

.dropdown-item.logout:hover {
    background: #fee;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* 로그인 폼 스타일 개선 */
.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.login-header .brand-accent {
    color: var(--accent-color);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input:invalid {
    border-color: #dc3545;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.login-button {
    width: 100%;
    padding: 0.875rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.login-button:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 메시지 스타일 */
.message {
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid;
}

.message.error {
    background: #fee;
    border-color: #fcc;
    color: #c66;
}

.message.success {
    background: #efe;
    border-color: #cfc;
    color: #6c6;
}

.message.warning {
    background: #ffc;
    border-color: #ffb;
    color: #996;
}

/* 로딩 상태 */
.loading {
    display: none;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-size: 0.9rem;
}

.loading.show {
    display: block;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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

/* 인증 서비스 상태 */
.auth-service-status {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.8rem;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.status-healthy {
    color: #28a745;
    background: #f8fff9;
    border-color: #d4edda;
}

.status-unhealthy {
    color: #dc3545;
    background: #fff8f8;
    border-color: #f5c6cb;
}

/* 무단 접근 페이지 스타일 */
.unauthorized-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.unauthorized-icon {
    font-size: 4rem;
    color: #dc3545;
    margin-bottom: 1rem;
}

.unauthorized-container h1 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.unauthorized-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.auth-info {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .user-info {
        display: none;
    }

    .user-dropdown {
        right: auto;
        left: 0;
    }

    .login-container {
        margin: 1rem;
        padding: 2rem;
    }

    .unauthorized-container {
        margin: 1rem;
        padding: 2rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 다크모드 대응 준비 */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #ffffff;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --bg-primary: #1a1a1a;
        --bg-secondary: #2a2a2a;
        --border-color: #404040;
    }
}

/* 포커스 상태 개선 */
.btn:focus,
.user-btn:focus,
.dropdown-item:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* 애니메이션 효과 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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