/* CSS 변수 및 리셋 영역 */
:root {
    /* 핵심 브랜드 테마: 오렌지 ~ 퍼플 그라데이션에서 모던하고 스포티하게 */
    --primary: #8b5cf6;
    /* 보라색 (메인) */
    --primary-light: #a78bfa;
    --primary-hover: #7c3aed;
    --secondary: #fb923c;
    /* 오렌지색 (강조 포인트, 폭죽/불꽃놀이 용도 등) */

    --bg-dark: #0f172a;
    /* 슬릭한 다크 모드 배경 (인스타나 NRC 느낌) */
    --glass-bg: rgba(30, 41, 59, 0.6);
    /* 글래스모피즘용 반투명 바탕 */
    --glass-border: rgba(255, 255, 255, 0.1);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, sans-serif;

    --border-radius-card: 24px;
    --bottom-nav-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

html,
body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========================================================= */
/* 1. 타이포그래피 (Typography) */
/* ========================================================= */
h1,
h2,
h3,
.font-heading {
    font-family: var(--font-heading);
}

.highlight {
    color: var(--secondary);
    font-weight: 800;
}

.highlight-text {
    color: var(--primary-light);
    font-weight: bold;
}

.text-primary {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 24px 16px 12px;
}

/* ========================================================= */
/* 2. 유틸리티 (Glassmorphism & Flex) */
/* ========================================================= */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-card);
    padding: 20px;
    margin: 10px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-card:active {
    transform: scale(0.98) translateY(0);
}

/* 클릭 시 살짝 눌리는 애니메이션 */

.flex-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.text-center {
    text-align: center;
}

.py-2 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.mt-1 {
    margin-top: 1rem;
}

.opacity-muted {
    opacity: 0.6;
}

/* ========================================================= */
/* 3. 레이아웃 (Layout) */
/* ========================================================= */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--glass-border);
}

.top-nav .logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav .logo h1 {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--primary);
    font-size: 28px !important;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    position: relative;
    cursor: pointer;
}

.badge.red {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

main {
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

/* 탭 전환 (SPA 로직) */
.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================= */
/* 4. 클럽 & 정모 피드 UI */
/* ========================================================= */
.club-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.club-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.meetup-card .meetup-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.meetup-card .tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.meetup-card .tag.d-day {
    background: rgba(251, 146, 60, 0.2);
    color: var(--secondary);
}

.meetup-card .tag.category {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-light);
}

.meetup-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.meetup-title.small {
    font-size: 1.1rem;
}

.meetup-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.detail-row .icon {
    font-size: 18px;
    color: var(--primary-light);
}

/* 참석자 프로필 스택 */
.avatar-stack {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-left: -12px;
    border: 2px solid var(--glass-bg);
    background-size: cover;
    background-position: center;
}

.avatar:first-child {
    margin-left: 0;
}

.avatar-count {
    margin-left: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* 정모 액션 버튼 */
.meetup-actions {
    display: grid;
    gap: 10px;
}

.btn {
    padding: 14px 20px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn.primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
    filter: brightness(1.1);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn.secondary.outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.btn.secondary.outline:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
}

.form-input:focus {
    border-color: var(--primary-light);
    background: rgba(0, 0, 0, 0.5);
}

.form-input option {
    background: #1e293b;
    color: white;
}


/* 작은 카드 형태 */
.meetup-header.line {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    margin-top: 0;
}

.status-badge {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
}

.summary-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-weight: 500;
    font-size: 0.9rem;
}

/* ========================================================= */
/* 5. 바텀 네비게이션 (PWA 느낌) */
/* ========================================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 15px 10px;
    /* 아이폰 하단 홈바 대응 padding-bottom */
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    padding-top: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item:hover {
    color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.nav-item.active {
    color: var(--primary-light);
    transform: scale(1.1) translateY(-2px);
}

.nav-icon {
    font-size: 26px !important;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font-heading);
}

/* 중앙 동그란 플로팅 버튼 느낌 (Matches/Live 용도) */
.center-action-btn {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    box-shadow: 0 4px 20px rgba(251, 146, 60, 0.4);
    display: flex;
    color: white;
    justify-content: center;
    align-items: center;
    border: 4px solid var(--bg-dark);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.center-action-btn:hover {
    transform: translateX(-50%) scale(1.1) rotate(5deg);
    box-shadow: 0 6px 25px rgba(251, 146, 60, 0.6);
}

.center-action-btn:active {
    transform: translateX(-50%) scale(0.95);
}



.center-action-btn span {
    font-size: 32px !important;
}

/* ========================================================= */
/* 6. 프로필 & 통계 */
/* ========================================================= */
.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--primary);
}

.stats-row {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 15px;
}

.stat-box {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    font-family: var(--font-heading);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.badge-icon {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 50%;
    color: var(--secondary);
    display: flex;
}

/* ========================================================= */
/* 7-1. 결제 신호등 토글 UI */
/* ========================================================= */
.traffic-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 8px rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    margin-bottom: 8px;
}

.traffic-light.green {
    background: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
}

.traffic-light.yellow {
    background: #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
}

.traffic-light.red {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}


/* ========================================================= */
/* 7. Live 경기 및 브라켓 UI */
/* ========================================================= */
.courts-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 0 16px;
}

.court-card {
    border-left: 4px solid var(--primary);
    padding: 15px;
    cursor: pointer;
}

.court-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.court-number {
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.match-teams {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.team {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 40%;
    text-align: center;
}

.player {
    font-weight: 600;
    font-size: 0.95rem;
}

.player small {
    color: var(--primary-light);
    font-weight: 500;
}

.vs-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 0.75rem;
    font-weight: 800;
    font-family: var(--font-heading);
    padding: 6px 8px;
    border-radius: 8px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.pulse {
    animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* ========================================================= */
/* 8. 포디움 & 랭킹 리스트 */
/* ========================================================= */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    margin: 20px 16px 30px;
    height: 160px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 30%;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.05), transparent);
    border-radius: 16px 16px 0 0;
    border-top: 1px solid var(--glass-border);
    padding-bottom: 15px;
    position: relative;
}

.podium-item.place-1 {
    height: 100%;
    border-top: 2px solid var(--secondary);
    background: linear-gradient(to top, rgba(251, 146, 60, 0.1), transparent);
}

.podium-item.place-2 {
    height: 80%;
    border-top: 2px solid #cbd5e1;
}

.podium-item.place-3 {
    height: 75%;
    border-top: 2px solid #b45309;
}

.podium-item .avatar {
    margin-bottom: 10px;
    width: 50px;
    height: 50px;
    background-size: cover;
    border-radius: 50%;
}

.podium-item .avatar-large {
    margin-bottom: 10px;
    border-width: 2px;
    background-size: cover;
    border-radius: 50%;
}

.rank-num {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.2rem;
}

.medal-gold {
    color: #fcd34d;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(252, 211, 77, 0.5);
}

.podium-item .name {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.podium-item .score {
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 700;
    margin-top: 4px;
}

.ranking-list {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rank-row {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
}

.rank-row .col-rank {
    width: 30px;
    font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

.rank-row .col-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-row .col-info .name {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rank-row .col-info .badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--text-main);
}

.rank-row .col-score {
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--primary-light);
}

/* ========================================================= */
/* 9. 모달 (Modal) */
/* ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    border-radius: 30px 30px 0 0;
    padding: 30px 20px calc(20px + env(safe-area-inset-bottom));
    margin: 0;
    box-shadow: none;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.score-input-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-field {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    text-align: center;
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.score-field:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
}