﻿/*
* 파일명: style.css
* 경로: /assets/css/style.css
* 기능: 메인 사이트 커스텀 스타일 (Bootstrap 5 호환)
* 작성일: 2025-08-22
* 수정일: 2026-08-26
*/

/* ======== [1차] CSS 변수 정의 (Bootstrap 확장) ======== */
:root {
    --primary-color: #10a37f;
    --primary-dark: #0d8f6b;
    --primary-gradient: linear-gradient(135deg, #10a37f 0%, #5664d2 100%);
    --secondary-color: #5664d2;
    --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- [2차] Bootstrap 커스텀 프로퍼티 오버라이드 ---- */
:root {
    --bs-primary: #10a37f;
    --bs-primary-rgb: 16, 163, 127;
    --bs-secondary: #5664d2;
    --bs-font-sans-serif: var(--font-family);
}

/* ======== [1차] 기본 설정 ======== */
body {
    font-family: var(--font-family);
    line-height: 1.6;
}

/* ======== [1차] 포커스 아웃라인 개선 ======== */

/* ---- [2차] 브랜드 로고 포커스 제거 ---- */
.navbar-brand:focus {
    outline: none;
    box-shadow: none;
}

/* ---- [2차] 네비게이션 링크 포커스 스타일 ---- */
.navbar-brand:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
    border-radius: 4px;
}

/* ---- [2차] 모든 링크 기본 포커스 제거 ---- */
a:focus {
    outline: none;
}

/* ---- [2차] 키보드 네비게이션 시에만 포커스 표시 ---- */
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ======== [1차] 네비게이션 스타일 ======== */

/* ---- [2차] 네비게이션 바 정렬 수정 ---- */
.navbar .navbar-nav {
    align-items: center;
}

/* ---- [2차] 네비게이션 아이템 정렬 ---- */
.navbar .nav-item {
    display: flex;
    align-items: center;
}

/* ---- [2차] 회원가입 버튼 스타일 수정 ---- */
.navbar .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.375rem;
}

/* ---- [2차] 네비게이션 브랜드 커스텀 ---- */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.navbar-brand:hover {
    color: var(--primary-dark) !important;
}

/* ---- [2차] 모바일 전체 메뉴 버튼 ---- */
@media (max-width: 991px) {
    .site-menu-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        min-width: 68px;
        min-height: 42px;
        padding: 0.4rem 0.65rem;
        color: #25313c;
        background-color: #f4f7f6;
        border: 1px solid #b8c6c2;
        border-radius: 8px;
        box-shadow: none;
    }

    .site-menu-toggler:hover,
    .site-menu-toggler:focus,
    .site-menu-toggler[aria-expanded="true"] {
        color: #086f5a;
        background-color: #e8f5f1;
        border-color: var(--primary-color);
        box-shadow: none;
    }

    .site-menu-toggler #navbarTogglerIcon {
        font-size: 1.35rem;
        line-height: 1;
    }

    .site-menu-label {
        font-size: 0.78rem;
        font-weight: 700;
        line-height: 1;
    }
}

/* ======== [1차] 커스텀 컴포넌트 (Bootstrap에 없는 것들만) ======== */

/* ---- [2차] 그라데이션 버튼 ---- */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-gradient);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 163, 127, 0.3);
    border: none;
}

/* ---- [2차] 버튼 포커스 스타일 개선 ---- */
.btn:focus {
    outline: none;
    box-shadow: none;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary:focus,
.btn-primary:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(16, 163, 127, 0.25);
}

.btn-outline-light {
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.9);
    color: var(--bs-dark);
    border-color: rgba(255,255,255,0.9);
}

/* ---- [2차] 호버 효과 강화 ---- */
.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* ---- [2차] 커스텀 폼 스타일 (Bootstrap과 차별화) ---- */
.input-wrapper {
    position: relative;
    margin-bottom: 1.25rem;
}

.input-wrapper input,
.input-wrapper textarea,
.input-wrapper select {
    padding-left: 2.75rem;
}

.input-wrapper input:focus,
.input-wrapper textarea:focus,
.input-wrapper select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(16, 163, 127, 0.25);
}

.input-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 5;
}

/* ---- [2차] 폼 컨트롤 포커스 개선 ---- */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(16, 163, 127, 0.25);
}

/* ---- [2차] CAPTCHA 커스텀 스타일 ---- */
.captcha-box {
    background: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.captcha-question {
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
    color: var(--bs-body-color);
}

/* ======== [1차] 푸터 링크 호버 효과 ======== */

/* ---- [2차] 푸터 영역 전체 링크 호버 효과 ---- */
footer a {
    transition: all 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    transform: translateX(3px);
}

/* ---- [2차] 소셜 미디어 아이콘 호버 효과 ---- */
footer .d-flex a:hover {
    color: var(--primary-color) !important;
    transform: scale(1.2) translateY(-2px) !important;
    text-shadow: 0 2px 8px rgba(16, 163, 127, 0.3);
}

/* ---- [2차] 이메일 및 전화번호 링크 특별 효과 ---- */
footer a[href^="mailto:"]:hover {
    color: #17a2b8 !important;
}

footer a[href^="tel:"]:hover {
    color: #28a745 !important;
}

/* ---- [2차] 리스트 아이템 호버시 아이콘 색상 변경 ---- */
footer .list-unstyled li:hover i {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

/* ---- [2차] Bootstrap의 opacity 클래스 오버라이드 ---- */
footer a.opacity-75:hover {
    opacity: 1 !important;
}

/* ======== [1차] 페이지별 특수 스타일 ======== */

/* ---- [2차] 이벤트 카드 호버 효과 ---- */
.event-card {
    transition: all 0.3s ease;
    border: 1px solid var(--bs-border-color);
}

.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 1.25rem 2.5rem rgba(0,0,0,0.12);
}

/* ---- [2차] 이벤트 메타 정보 스타일 ---- */
.event-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.event-meta-item i {
    color: var(--primary-color);
    width: 16px;
    flex-shrink: 0;
}

/* ---- [2차] 이벤트 카테고리 배지 ---- */
.event-category {
    background: var(--primary-gradient);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 0.75rem;
}

/* ---- [2차] 이벤트 제목 링크 ---- */
.event-title a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.event-title a:hover {
    color: var(--primary-color);
}

/* ---- [2차] 필터 태그 ---- */
.filter-tag {
    background: var(--bs-light);
    color: var(--bs-body-color);
    padding: 0.375rem 0.75rem;
    border-radius: 1.25rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.25rem;
    border: 1px solid var(--bs-border-color);
}

.filter-tag .remove {
    color: var(--bs-secondary-color);
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.filter-tag .remove:hover {
    color: var(--bs-danger);
}

/* ======== [1차] 관리자 페이지용 스타일 ======== */

/* ---- [2차] 관리자 사이드바 ---- */
.admin-sidebar {
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    min-height: 100vh;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--primary-color);
    color: white;
}

/* ---- [2차] 관리자 통계 카드 ---- */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

/* ======== [1차] 유틸리티 클래스 (Bootstrap 보완) ======== */

/* ---- [2차] 텍스트 그라데이션 ---- */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- [2차] 부드러운 그림자 ---- */
.shadow-soft {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.shadow-soft-lg {
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.12);
}

/* ---- [2차] 로딩 애니메이션 ---- */
.loading {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* ---- [2차] 선택 불가 텍스트 ---- */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ======== [1차] 반응형 조정 ======== */
@media (max-width: 768px) {
    /* [3차] 모바일 버튼 그룹 */
    .btn-group-mobile {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        border-radius: 0.5rem !important;
    }
    
    /* [3차] 모바일 테이블 */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* [3차] 모바일 관리자 사이드바 */
    .admin-sidebar {
        min-height: auto;
    }
    
    /* [3차] 모바일 네비게이션 회원가입 버튼 */
    .navbar .nav-item.ms-2 {
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }
}

/* ======== [1차] 접근성 개선 ======== */

/* ---- [2차] 키보드 네비게이션 전용 포커스 스타일 ---- */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ---- [2차] 부드러운 스크롤 ---- */
html {
    scroll-behavior: smooth;
}

/* ======== [1차] 페이지네이션 ======== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

/* ======== [1차] 인쇄 스타일 ======== */
@media print {
    .navbar,
    .btn,
    .pagination,
    .filter-tag {
        display: none !important;
    }
    
    .event-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* ======== [1차] Breadcrumb ======== */

/* ---- [2차] Breadcrumb 스타일 수정 ---- */

.bg-primary .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

.bg-primary .breadcrumb-item {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.bg-primary .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s ease;
}

.bg-primary .breadcrumb-item a:hover {
    color: white;
    text-decoration: underline;
}

.bg-primary .breadcrumb-item.active {
    color: white;
    font-weight: 500;
}

.bg-primary .breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: rgba(255, 255, 255, 0.6);
    padding: 0 0.5rem;
}

/* ---- [2차] Breadcrumb 반응형 처리 ---- */
@media (max-width: 768px) {
    .bg-primary .breadcrumb-item {
        font-size: 0.85rem;
    }
    
    .bg-primary .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.3rem;
    }
}

/* ======== [1차] 광고 시스템 ======== */
/* 작성일: 2026-08-23 — 프리미엄 노출 배지 · 배너 슬롯 */

/* ---- [2차] 목록 내 프리미엄(유료 노출) 이벤트 행 ---- */
.event-table tbody tr.event-row-premium {
    background-color: #fffdf3;
}

/* ---- [2차] 광고 표기 배지 (표시 의무 — 임의로 숨기지 말 것) ---- */
.ad-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    margin-right: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
    color: #8a6d00;
    background-color: #fff3cd;
    border: 1px solid #ffe08a;
    border-radius: 3px;
    vertical-align: middle;
}

/* ---- [2차] 배너 슬롯 공통 ---- */
.ad-slot {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background-color: #fff;
}

/* picture 는 기본이 inline 이라 아래에 여백이 생긴다 — PC/모바일 배너 분리 노출용 */
.ad-slot picture {
    display: block;
}

.ad-slot .ad-slot-img {
    display: block;
    width: 100%;
    height: auto;
}

/* 광고임을 알리는 라벨 — 이미지 위 우측 하단 고정 */
.ad-slot .ad-slot-label {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 0.05rem 0.35rem;
    font-size: 0.65rem;
    line-height: 1.5;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.55);
    border-radius: 3px 0 0 0;
}

/* ---- [2차] 목록 중간 배너 행 ---- */
.event-table tbody tr.ad-row td {
    padding: 0.75rem 0.5rem;
    background-color: #fafafa;
}

/* ---- [2차] 슬롯별 최대 높이 (레이아웃 붕괴 방지) ----

   [2026-09-04 변경] cover -> contain. 잘라내지 않는다.

   본문 폭은 Bootstrap 기본값이라 넓은 화면에서 .container 가 1320px(안쪽 1296px)까지 늘어난다.
   그런데 권장 크기가 1200px 이라, 규격을 지켜 만든 1200x200(6:1) 배너가 1296px 자리에서
   216px 높이가 되어 max-height:200px 에 걸렸다. cover 였으므로 위아래 16px 이 잘려나갔다.
   규격을 지킨 광고주가 손해를 보는 구조였다.

   ① 권장 크기를 실제 슬롯 폭에 맞춰 키웠다(1400 기준 — getAdProducts() 참조).
   ② max-height 를 "규격 높이 + 약 20% 여유"로 잡았다. 규격을 지킨 배너는 물론,
      비율이 조금 어긋난 배너도 잘리거나 여백이 생기지 않고 그대로 나온다.
        슬롯        권장 크기   가장 넓은 화면에서의 높이   max-height
        메인 상단   1400x200    1296px 폭 → 185px          220px
        목록 중간   1400x160    1280px 폭 → 146px          175px
        상세 사이드  600x500     300px 폭 → 250px          300px
      (제한을 아예 없애지는 않는다. 정사각형 이미지가 올라오면 슬롯이 화면을 삼킨다.)
   ③ 그래도 크게 어긋난 배너는 있을 수 있으므로 cover 를 contain 으로 바꿨다.
      높이 제한에 걸리면 잘라내는 대신 축소해 전체를 보여주고, 남는 자리는 흰 배경이 채운다.
      내용이 소리 없이 잘려나가는 것보다 낫다.

   ※ aspect-ratio 로 슬롯 비율을 아예 못 박는 방법도 검토했지만 쓰지 않았다.
     규격과 다른 비율로 이미 올라와 있는 배너에 좌우 흰 여백이 생기고,
     아래 ad-slot-has-mobile 의 "모바일 배너는 원본 비율 그대로" 규칙과도 충돌한다.

   ⚠️ 아래 수치는 includes/ad_functions.php 의 getAdProducts() 권장 크기와 한 쌍이다.
      한쪽만 고치면 다시 잘리기 시작한다. 반드시 같이 고칠 것. */
.ad-slot-main_top .ad-slot-img {
    max-height: 220px;
    object-fit: contain;
}

.ad-slot-list_inline .ad-slot-img {
    max-height: 175px;
    object-fit: contain;
}

.ad-slot-event_sidebar .ad-slot-img {
    max-height: 300px;
    object-fit: contain;
}

/* 모바일 — PC 배너 한 장만 있을 때는 높이를 제한해 레이아웃을 지킨다
   (브레이크포인트는 renderAdSlot() 의 <source media> 값과 같아야 한다) */
@media (max-width: 767.98px) {
    .ad-slot-main_top .ad-slot-img,
    .ad-slot-list_inline .ad-slot-img {
        max-height: 120px;
    }

    /* 모바일 전용 배너를 따로 올린 경우 — 광고주가 그 비율로 만든 이미지이므로
       잘라내지 않고 전체를 보여준다 (정사각형·세로형 배너 대응) */
    .ad-slot.ad-slot-has-mobile .ad-slot-img {
        max-height: none;
        object-fit: contain;
    }
}

/* ======== [1차] 우측 퀵메뉴 (문의 / 광고 / FAQ / TOP) ======== */

/* ---- [2차] 패널 ---- */
.quick-menu {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 1010; /* sticky-top 네비게이션(1020)보다 아래 */
    display: flex;
    flex-direction: column;
    width: 84px;
    background-color: #33383d;
    border-radius: 12px;
    overflow: hidden;
}

/* ---- [2차] 항목 (링크·버튼 공통) ---- */
.quick-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 6px;
    border: 0;
    background-color: transparent;
    color: #ffffff;
    font-family: inherit; /* button 요소는 폰트를 상속하지 않는다 */
    font-size: 0.8rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.quick-menu-item + .quick-menu-item {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.quick-menu-item i {
    font-size: 1.3rem;
}

.quick-menu-item:hover,
.quick-menu-item:focus-visible {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* [3차] 강조 항목 (광고) */
.quick-menu-item-accent,
.quick-menu-item-accent:hover,
.quick-menu-item-accent:focus-visible {
    color: var(--primary-color);
}

/* ---- [2차] TOP 항목 — 스크롤 전에는 숨김 ---- */
.quick-menu-top {
    display: none;
}

.quick-menu-top.is-visible {
    display: flex;
}

/* ---- [2차] 태블릿 — 아이콘만 표시 ---- */
@media (max-width: 991.98px) {
    .quick-menu {
        right: 12px;
        width: 54px;
        border-radius: 10px;
    }

    .quick-menu-item {
        padding: 12px 4px;
    }

    .quick-menu-item i {
        font-size: 1.2rem;
    }

    .quick-menu-label {
        display: none;
    }
}

/* ---- [2차] 모바일 — 우측 하단으로 이동 ---- */
@media (max-width: 767.98px) {
    .quick-menu {
        top: auto;
        bottom: 16px;
        right: 10px;
        width: 46px;
        transform: none;
    }

    .quick-menu-item {
        padding: 10px 4px;
    }

    .quick-menu-item i {
        font-size: 1.1rem;
    }
}

/* ---- [2차] 인쇄 시 숨김 ---- */
@media print {
    .quick-menu {
        display: none;
    }
}
