/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 기본 스타일 */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --danger-color: #E74C3C;
    --background-color: #F8F9FA;
    --text-color: #333;
    --border-color: #DDD;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --header-height: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Segoe UI', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: var(--header-height);
}

a {
    text-decoration: none;
    color: inherit;
}

/* 컨테이너 */
.container {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem;
}

/* 모바일 헤더 */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
}

.header-left,
.header-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-left {
    justify-content: flex-start;
}

.header-right {
    justify-content: flex-end;
    gap: 0.75rem;
}

.header-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.back-button {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
}

.header-icon {
    font-size: 1.25rem;
    color: var(--text-color);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon:hover {
    color: var(--primary-color);
}

/* 메인 컨텐츠 */
.main-content {
    min-height: calc(100vh - var(--header-height));
}

/* 메인 페이지 스타일 */
.main-container {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem;
}

.user-welcome {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.user-welcome h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-department {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.user-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
}

.stat-divider {
    opacity: 0.5;
    font-size: 1.2rem;
}

.user-points {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1.25rem;
    font-weight: bold;
}

/* Level Badge Styles */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.25);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: help;
}

.header-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.header-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.header-streak-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.header-streak-badge:active {
    transform: scale(0.95);
}

/* Level Progress Bar */
.level-progress {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 12px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.95;
}

.progress-points {
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 메뉴 섹션 */
.menu-section {
    padding: 1rem;
}

.menu-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 1.25rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.menu-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.menu-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.menu-icon i {
    font-size: 1.5rem;
    color: white;
}

.fa-swords:before {
    content: "⚔️";
    font-style: normal;
}

.menu-text {
    flex: 1;
}

.menu-text h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.menu-text p {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
}

.menu-arrow {
    color: #999;
    font-size: 1.25rem;
    margin-left: 0.5rem;
}

/* 버튼 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

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

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

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

.btn-secondary:hover {
    background-color: #40b868;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 카드 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* 유틸리티 클래스 */
.text-success {
    color: var(--secondary-color);
}

.text-danger {
    color: var(--danger-color);
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* 폼 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* 알림 메시지 */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 푸터 */
.footer {
    background: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.footer p {
    color: #666;
    font-size: 0.9rem;
}

/* 반응형 디자인 */
@media (min-width: 769px) {
    /* PC 환경에서도 모바일 뷰 유지 */
    body {
        background: #e0e0e0;
    }
    
    .mobile-header,
    .main-content {
        max-width: 768px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .mobile-header {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: 768px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1rem;
    }
    
    .user-welcome h2 {
        font-size: 1.25rem;
    }
    
    .menu-item {
        padding: 1rem 0.75rem;
    }
    
    .menu-icon {
        width: 45px;
        height: 45px;
    }
    
    .menu-text h3 {
        font-size: 0.9rem;
    }
    
    .menu-text p {
        font-size: 0.8rem;
    }
}

/* 마이페이지 스타일 */
.profile-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar {
    font-size: 4rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.profile-department {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.profile-student-id {
    color: #888;
    font-size: 0.85rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.profile-stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
}

.stat-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.setting-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.setting-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-title i {
    color: var(--primary-color);
}

.setting-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.form-help {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.25rem;
}

.required {
    color: var(--danger-color);
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background-color: #ccc;
    border-radius: 14px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background-color: var(--secondary-color);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(22px);
}

.toggle-text {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert i {
    font-size: 1.25rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .profile-stat-item {
        justify-content: center;
    }
}
