* {
    box-sizing: border-box;
}

/* 전체 기본 스타일 */
html,
body {
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f8f9fa;
    color: #1a1a1a;
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.6;
}

/* 메인 컨테이너 */
.container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 300px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 상단 헤더 영역 */
.header {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    padding: 1rem 2rem;
    border-bottom: 3px solid #C60B24;
    flex-shrink: 0;
}

.page-title {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.025em;
}

/* 하단 콘텐츠 영역 (사이드바 + 메인) */
.content-wrapper {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    min-height: 0;
}

/* 좌측 사이드바 */
.sidebar {
    width: 240px;
    min-width: 220px;
    flex-shrink: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    height: fit-content;
    max-height: 100%;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #C60B24;
    border-bottom: 1px solid #e9ecef;
}

.category-list {
    list-style: none;
    padding: 1rem;
    margin: 0;
}

.category-item {
    margin-bottom: 0.375rem;
}

.category-link {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: #6b7280;
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.category-link:hover {
    background: #f9fafb;
    color: #C60B24;
    transform: translateX(2px);
}

.category-link.active {
    background: rgba(198, 11, 36, 0.08);
    color: #C60B24;
    font-weight: 600;
    border-left: 4px solid #C60B24;
}

/* 메인 콘텐츠 영역 */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 이벤트 리스트 */
.event-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 0;
}

.event-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 2rem;
}

/* 이벤트 카드 */
.event-card {
    display: flex;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    min-height: 160px;
    cursor: pointer;
    position: relative;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-color: #C60B24;
}

/* 지난 이벤트 스타일 */
.event-card.expired {
    opacity: 0.6;
    filter: grayscale(30%);
}

.event-card.expired:hover {
    transform: none;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    border-color: #9ca3af;
}

.expired-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(107, 114, 128, 0.9);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

.event-img {
    width: 340px;
    min-width: 280px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.event-img img {
    width: 100%;
    object-fit: cover;
    display: block;
}

.event-info {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.event-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    letter-spacing: -0.025em;
}

.event-desc {
    color: #6b7280;
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.event-meta {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.event-date {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.event-price {
    font-size: 1.125rem;
    color: #C60B24;
    font-weight: 700;
    margin-bottom: 0;
}

/* 로딩 및 에러 메시지 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 0.9375rem;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
    font-size: 0.9375rem;
}

/* 레이어 팝업 */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.popup-overlay.active {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    animation: popupIn 0.25s ease-out;
}

@keyframes popupIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.popup-message {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.popup-close-btn {
    background: #C60B24;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.popup-close-btn:hover {
    background: #a5091e;
}

/* 스크롤바 커스터마이징 */
.event-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.event-list::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #C60B24;
}

/* 반응형 디자인 - 태블릿 */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
        gap: 1rem;
    }

    .content-wrapper {
        gap: 1rem;
    }

    .sidebar {
        width: 220px;
        min-width: 200px;
    }

    .event-img {
        width: 220px;
        min-width: 220px;
    }

    .event-img img {
        height: 140px;
    }

    .header {
        padding: 1.25rem 1.5rem;
    }

    .page-title {
        font-size: clamp(1.375rem, 2.8vw, 1.75rem);
    }
}

/* 반응형 디자인 - 모바일 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .content-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        order: 1;
    }

    .category-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
        padding: 1rem;
    }

    .category-link {
        text-align: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .main-content {
        order: 2;
    }

    .event-list {
        overflow-y: visible;
        height: auto;
    }

    .event-card {
        flex-direction: column;
        min-height: auto;
    }

    .event-img {
        width: 100%;
        min-width: auto;
    }

    .event-img img {
        height: 200px;
    }

    .event-info {
        padding: 1.25rem;
    }

    .header {
        padding: 1rem 1.5rem;
        border-radius: 12px;
    }

    .page-title {
        font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    }

    .event-title {
        font-size: 1.125rem;
    }

    .event-price {
        font-size: 1rem;
    }
}

/* 작은 모바일 */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    .header {
        padding: 0.875rem 1rem;
    }

    .page-title {
        font-size: clamp(1.125rem, 2.2vw, 1.375rem);
    }

    .event-info {
        padding: 1rem;
    }

    .event-title {
        font-size: 1rem;
    }

    .event-desc {
        font-size: 0.875rem;
    }
}