/**
 * Custom CSS for CodeIgniter4-Bootstrap5 Frontend
 * 프론트엔드 커스텀 스타일
 */

/* ===================================
   Popup Styles (Admin Popup System)
   =================================== */

#popupContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

#popupContainer>* {
    pointer-events: auto;
}

/* 레이어 팝업 (오버레이 없음) */
.popup-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.popup-top-left {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
}

.popup-top-right {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.popup-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
}

.popup-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.popup-custom {
    position: fixed;
    z-index: 9999;
}

.popup-box {
    background: #fff;
    border-radius: 0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    transition: box-shadow 0.2s ease;
}

.popup-draggable {
    cursor: move;
}

.popup-static {
    cursor: default;
}

.popup-media {
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.popup-media img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.popup-close {
    position: absolute;
    top: 5px;
    right: 6px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 10;
}

.popup-close .bx {
    font-size: 38px;
    line-height: 1;
}

.popup-close:hover {
    color: #e5e7eb;
}

.popup-body {
    padding: 24px 28px 20px;
    text-align: center;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #111827;
}

.popup-text {
    font-size: 14px;
    color: #1f2937;
    line-height: 1.6;
    white-space: pre-line;
}

.popup-footer {
    display: flex;
    padding: 0;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.popup-action {
    flex: 1;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: #fff;
    color: #111827;
    transition: background 0.2s ease;
}

.popup-action+.popup-action {
    border-left: 1px solid #e5e7eb;
}

.popup-hide-btn {
    background: #f8f9fb;
}

.popup-hide-btn:hover {
    background: #eef1f7;
}

.popup-close-btn:hover {
    background: #f4f5f7;
}

/* ===================================
   Main Styles (CodeIgniter 4.6.3 with Bootstrap 5.3.3)
   =================================== */

/* CodeIgniter 4.6.3 with Bootstrap 5.3.3 - Main Styles */

/* ===================================
   Theme Variables (Light/Dark Mode)
   =================================== */

:root,
[data-bs-theme="light"] {
    --custom-bg: #ffffff;
    --custom-text: #212529;
    --custom-border: #dee2e6;
    --custom-shadow: rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] {
    --custom-bg: #0b0f19;
    --custom-text: #e9ecef;
    --custom-border: #495057;
    --custom-shadow: rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .navbar-brand {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] .card {
    background-color: #1a1f2e;
    border-color: #495057;
}

[data-bs-theme="dark"] .feature-card,
[data-bs-theme="dark"] .stats-card {
    background: rgba(26, 31, 46, 0.9);
}


/* ===================================
   Page Loading Spinner
   =================================== */

.page-loading {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-transition: all .4s .2s ease-in-out;
    transition: all .4s .2s ease-in-out;
    background-color: #fff;
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
}

[data-bs-theme="dark"] .page-loading {
    background-color: #0b0f19;
}

.page-loading.active {
    opacity: 1;
    visibility: visible;
}

.page-loading-inner {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    text-align: center;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    -webkit-transition: opacity .2s ease-in-out;
    transition: opacity .2s ease-in-out;
    opacity: 0;
}

.page-loading.active>.page-loading-inner {
    opacity: 1;
}

.page-loading-inner>span {
    display: block;
    font-size: 1rem;
    font-weight: normal;
    color: #9397ad;
}

[data-bs-theme="dark"] .page-loading-inner>span {
    color: #fff;
    opacity: .6;
}

.page-spinner {
    display: inline-block;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: .75rem;
    vertical-align: text-bottom;
    border: .15em solid #b4b7c9;
    border-right-color: transparent;
    border-radius: 50%;
    -webkit-animation: spinner .75s linear infinite;
    animation: spinner .75s linear infinite;
}

[data-bs-theme="dark"] .page-spinner {
    border-color: rgba(255, 255, 255, .4);
    border-right-color: transparent;
}

@-webkit-keyframes spinner {
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

@keyframes spinner {
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    color: #006a60 !important;
}

/* Hero Section */
.hero-section {
    background: radial-gradient(144.3% 173.7% at 71.41%, rgba(0, 106, 96, 0.1) 0%, rgba(19, 157, 146, 0.06) 32.49%, rgba(241, 244, 253, 0.07) 82.52%);
    min-height: 100vh;
    padding-top: 120px;
}

/* Cards */
.stats-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.feature-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn-outline-primary {
    border-color: #006a60;
    color: #006a60;
}

.btn-outline-primary:hover {
    background-color: #006a60;
    border-color: #006a60;
    color: white;
}

.btn-primary {
    background-color: #006a60;
    border-color: #006a60;
}

.btn-primary:hover {
    background-color: #00574f;
    border-color: #00574f;
}

/* ===================================
   Layer Popup Styles (네임스페이스로 충돌 방지)
   =================================== */

.layer-popup-wrapper {
    position: fixed;
    z-index: 9999;
}

.layer-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: popupEnter 0.3s ease-out forwards;
    opacity: 0;
}

.layer-popup-wrapper.show .layer-popup {
    animation: popupEnter 0.3s ease-out forwards;
    opacity: 1;
}

.layer-popup.dragging {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.layer-popup .popup-header {
    background: linear-gradient(135deg, #006a60 0%, #139d92 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 40px;
}

.layer-popup .popup-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 20px;
}

.layer-popup .popup-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.layer-popup .popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.layer-popup .popup-image-wrapper {
    margin-bottom: 16px;
    width: 100%;
}

.layer-popup .popup-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.layer-popup .popup-text {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.layer-popup .popup-link {
    padding: 10px 24px;
    background: linear-gradient(135deg, #006a60 0%, #139d92 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

.layer-popup .popup-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 106, 96, 0.35);
    color: white !important;
}

/* 위치별 스타일 */
.layer-popup.popup-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
}

.layer-popup.popup-top-left {
    top: 20px !important;
    left: 20px !important;
}

.layer-popup.popup-top-right {
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
}

.layer-popup.popup-bottom-left {
    bottom: 20px !important;
    left: 20px !important;
    top: auto !important;
}

.layer-popup.popup-bottom-right {
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
}

/* 애니메이션 */
@keyframes popupEnter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popupExit {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .layer-popup {
        width: 90vw !important;
        max-width: 90vw;
    }

    .layer-popup.popup-top-left,
    .layer-popup.popup-top-right,
    .layer-popup.popup-bottom-left,
    .layer-popup.popup-bottom-right {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
        bottom: auto !important;
    }

    .layer-popup .popup-content {
        padding: 16px;
    }

    .layer-popup .popup-header {
        padding: 8px 12px;
    }
}

/* 스크롤 스타일 */
.layer-popup .popup-content::-webkit-scrollbar {
    width: 6px;
}

.layer-popup .popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.layer-popup .popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.layer-popup .popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===================================
   Home Page Custom Styles
   =================================== */

.hero-section-bg {
    background: radial-gradient(116.18% 118% at 50% 100%, rgba(0, 106, 96, 0.1) 0%, rgba(19, 157, 146, 0.06) 41.83%, rgba(241, 244, 253, 0.07) 82.52%);
}

.features-phone-container {
    max-width: 348px;
}

.features-card-overlay {
    max-width: 348px;
    right: -2.75rem;
}

.cta-bg-gradient {
    background: linear-gradient(135deg, rgba(0, 106, 96, 0.95) 0%, rgba(19, 157, 146, 0.95) 100%);
    background-size: cover;
}

/* ===================================
   About Page Custom Styles
   =================================== */

.about-hero-text {
    max-width: 526px;
}

/* ===================================
   Contact Page Custom Styles
   =================================== */

.contact-section {
    margin-top: 100px;
    min-height: calc(100vh - 300px);
}

.contact-card {
    border: none;
    box-shadow: 0 0.5rem 1.125rem -0.5rem rgba(75, 70, 92, 0.08);
}

.contact-info-item {
    display: flex;
    align-items: start;
    margin-bottom: 1.5rem;
}

.contact-info-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #006a60 0%, #139d92 100%);
    color: white;
    border-radius: 0.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.contact-form .form-control,
.contact-form .form-select {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.btn-primary-gradient {
    background: linear-gradient(135deg, #006a60 0%, #139d92 100%);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
}

.btn-primary-gradient:hover {
    background: linear-gradient(135deg, #139d92 0%, #006a60 100%);
}

.contact-map-iframe {
    border: 0;
}

/* ===================================
   Auth Pages Custom Styles
   =================================== */

.auth-section {
    margin-top: 100px;
    min-height: calc(100vh - 300px);
}

/* ===================================
   Board Pages Custom Styles
   =================================== */

.board-section {
    margin-top: 100px;
    min-height: calc(100vh - 300px);
}

/* ===================================
   Board Themes Styles
   =================================== */

/* ===================================
   게시판 카테고리별 테마 스타일
   =================================== */

/* Board Icon Colors */
.board-icon-inquiry {
    color: #0d6efd;
}

.board-icon-notice {
    color: #dc3545;
}

.board-icon-faq {
    color: #198754;
}

.board-icon-gallery {
    color: #6f42c1;
}

/* 공통 스타일 */
.board-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.board-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.board-title i {
    font-size: 2rem;
}

/* ===================================
   Notice (공지사항) - 공식적인 스타일
   =================================== */
.board-category-notice {
    --board-theme-color: #dc3545;
    --board-theme-light: #f8d7da;
}

.board-category-notice .board-title {
    color: var(--board-theme-color);
}

.board-category-notice .board-item-notice {
    background: linear-gradient(to right, #fff5f5 0%, #ffffff 100%);
    border-left: 4px solid var(--board-theme-color);
    font-weight: 600;
}

.board-category-notice .board-item-notice .badge {
    background: var(--board-theme-color) !important;
}

.board-category-notice .btn-primary {
    background-color: var(--board-theme-color);
    border-color: var(--board-theme-color);
}

.board-category-notice .btn-primary:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.board-list-official .board-item {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    transition: all 0.3s;
}

.board-list-official .board-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

/* ===================================
   Inquiry (문의) - 프라이빗 스타일
   =================================== */
.board-category-inquiry {
    --board-theme-color: #0d6efd;
    --board-theme-light: #cfe2ff;
}

.board-category-inquiry .board-title {
    color: var(--board-theme-color);
}

.board-category-inquiry .btn-primary {
    background-color: var(--board-theme-color);
    border-color: var(--board-theme-color);
}

.board-list-private .board-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.board-list-private .board-item-private {
    background: #f8f9fa;
    position: relative;
}

.board-list-private .board-item-private::before {
    content: "🔒";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.3;
}

.board-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
}

.board-status-pending {
    background-color: #ffc107;
    color: #000;
}

.board-status-answered {
    background-color: #198754;
    color: #fff;
}

/* ===================================
   FAQ - 아코디언 스타일
   =================================== */
.board-category-faq {
    --board-theme-color: #198754;
    --board-theme-light: #d1e7dd;
}

.board-category-faq .board-title {
    color: var(--board-theme-color);
}

.board-accordion-layout .accordion-item {
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem !important;
    overflow: hidden;
}

.board-accordion-layout .accordion-button {
    background-color: white;
    color: #333;
    font-weight: 600;
    padding: 1rem 1.5rem;
}

.board-accordion-layout .accordion-button:not(.collapsed) {
    background-color: var(--board-theme-light);
    color: var(--board-theme-color);
}

.board-accordion-layout .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23198754'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.board-accordion-layout .accordion-body {
    padding: 1.5rem;
    background-color: #f8f9fa;
}

.faq-category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.faq-category-tabs .btn {
    border-radius: 2rem;
}

/* ===================================
   Gallery - 그리드 스타일
   =================================== */
.board-category-gallery {
    --board-theme-color: #6f42c1;
    --board-theme-light: #e0cffc;
}

.board-category-gallery .board-title {
    color: var(--board-theme-color);
}

.board-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .board-grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

.board-grid-item {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.board-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.board-grid-item-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #006a60 0%, #139d92 100%);
}

.board-grid-item-content {
    padding: 1rem;
}

.board-grid-item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-grid-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Lightbox 스타일 */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   반응형
   =================================== */
@media (max-width: 768px) {
    .board-header {
        margin-bottom: 1rem;
    }

    .board-title i {
        font-size: 1.5rem;
    }

    .board-list-official .board-item,
    .board-list-private .board-item {
        padding: 0.75rem;
    }
}

/* ===================================
   공통 유틸리티
   =================================== */
.board-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.board-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.board-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
}

.board-stats-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.board-new-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===================================
   Accessibility Styles
   =================================== */

/**
 * Accessibility Styles
 * WCAG 2.1 준수를 위한 접근성 스타일
 */

/* ==========================================================================
   1. Screen Reader Only (SR-Only)
   ========================================================================== */

/**
 * 스크린 리더 전용 텍스트
 * 화면에는 보이지 않지만 스크린 리더에서는 읽힘
 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/**
 * 포커스 시 보이는 스크린 리더 전용 텍스트
 * Skip links에 사용
 */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ==========================================================================
   2. Skip Links
   ========================================================================== */

/**
 * Skip to Main Content 링크
 * 키보드 사용자가 네비게이션을 건너뛸 수 있게 함
 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background-color: #000;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* ==========================================================================
   3. Focus Styles
   ========================================================================== */

/**
 * 기본 포커스 스타일
 * WCAG 2.1 Success Criterion 2.4.7 (Focus Visible)
 */
:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/**
 * 링크 포커스
 */
a:focus {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
    text-decoration: underline;
}

/**
 * 버튼 포커스
 */
button:focus,
.btn:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
}

/**
 * 폼 입력 필드 포커스
 */
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #2196F3;
    outline-offset: 0;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

/**
 * 포커스 가시성 개선
 * 어두운 배경에서도 보이도록
 */
.dark-bg :focus,
.bg-dark :focus {
    outline-color: #FFC107;
}

/**
 * Focus within (컨테이너 내부 포커스)
 */
.focus-within:focus-within {
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
}

/* ==========================================================================
   4. High Contrast Mode Support
   ========================================================================== */

/**
 * Windows High Contrast Mode 지원
 */
@media (prefers-contrast: high) {
    :focus {
        outline-width: 4px;
        outline-offset: 3px;
    }

    button,
    .btn {
        border: 2px solid;
    }
}

/* ==========================================================================
   5. Reduced Motion
   ========================================================================== */

/**
 * 애니메이션 감소 선호 설정 지원
 * WCAG 2.1 Success Criterion 2.3.3 (Animation from Interactions)
 */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   6. Color Contrast
   ========================================================================== */

/**
 * 최소 대비율 4.5:1 보장
 * WCAG 2.1 Success Criterion 1.4.3 (Contrast Minimum)
 */

/* 텍스트 기본 색상 */
body {
    color: #212529;
    /* 대비율: 15.8:1 (흰 배경) */
    background-color: #ffffff;
}

/* 링크 색상 */
a:not([class]) {
    color: #0056b3;
    /* 대비율: 7.0:1 (흰 배경) */
}

a:not([class]):hover,
a:not([class]):focus {
    color: #003d82;
    /* 대비율: 9.7:1 */
}

/* 버튼 색상 */
.btn-primary {
    background-color: #0056b3;
    color: #ffffff;
    /* 대비율: 7.0:1 */
    border: 2px solid #0056b3;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #003d82;
    border-color: #003d82;
}

/* 경고 색상 */
.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    /* 대비율: 8.5:1 */
    border: 1px solid #ffecb5;
}

/* 오류 색상 */
.alert-danger,
.text-danger {
    color: #c82333;
    /* 대비율: 5.0:1 */
}

/* 성공 색상 */
.alert-success,
.text-success {
    color: #155724;
    /* 대비율: 9.4:1 */
}

/* ==========================================================================
   7. Form Accessibility
   ========================================================================== */

/**
 * 필수 필드 표시
 */
label.required::after,
.form-label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/**
 * 오류 메시지
 */
.invalid-feedback,
.error-message {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
    font-weight: 500;
}

.invalid-feedback::before,
.error-message::before {
    content: "⚠ ";
}

/**
 * 유효성 검사 상태
 */
.is-invalid,
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-valid,
input[aria-invalid="false"],
select[aria-invalid="false"],
textarea[aria-invalid="false"] {
    border-color: #28a745;
}

/* ==========================================================================
   8. Keyboard Navigation
   ========================================================================== */

/**
 * 탭 순서 표시 (디버그용)
 */
body.show-tab-order [tabindex]:focus::before {
    content: attr(tabindex);
    position: absolute;
    top: -20px;
    left: 0;
    padding: 2px 5px;
    background-color: #ffc107;
    color: #000;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
}

/**
 * Interactive 요소 최소 크기
 * WCAG 2.1 Success Criterion 2.5.5 (Target Size)
 */
.interactive-target,
button:not(.size-reset),
.btn:not(.size-reset) {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 1rem;
}

/* 작은 버튼 예외 (인접하지 않은 경우) */
.btn-sm {
    min-height: 32px;
    min-width: 32px;
    padding: 0.25rem 0.5rem;
}

/* ==========================================================================
   9. ARIA Live Regions
   ========================================================================== */

/**
 * 라이브 영역 스타일
 */
[aria-live] {
    position: relative;
}

[aria-live="assertive"] {
    /* 스크린 리더가 즉시 읽음 */
    font-weight: bold;
}

.alert[role="alert"] {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    border: 2px solid;
}

/* ==========================================================================
   10. Modal & Dialog Accessibility
   ========================================================================== */

/**
 * 모달 배경 오버레이
 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
}

/**
 * 검색 모달 배경 오버레이
 */
#searchModalOverlay {
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(2px);
    z-index: 1;
}

#searchModal>div:last-child {
    z-index: 10;
}

#searchModal[role="dialog"] {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    width: auto;
    max-width: none;
    max-height: none;
    overflow: visible;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

/**
 * 검색 모달 애니메이션
 */
#searchModal>div>div {
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/**
 * 모달 컨테이너
 */
[role="dialog"],
[role="alertdialog"] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
}

/**
 * 모달이 열릴 때 body 스크롤 방지
 */
body.modal-open {
    overflow: hidden;
}

/* ==========================================================================
   11. Table Accessibility
   ========================================================================== */

/**
 * 테이블 접근성
 */
table caption {
    padding: 0.75rem;
    color: #6c757d;
    text-align: left;
    caption-side: top;
    font-size: 1.1rem;
    font-weight: bold;
}

table th {
    font-weight: bold;
    text-align: left;
}

table th[scope="row"] {
    font-weight: 600;
}

/**
 * 반응형 테이블 (모바일)
 */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   12. Print Styles
   ========================================================================== */

/**
 * 인쇄 시 접근성 유지
 */
@media print {

    .skip-link,
    .sr-only {
        display: none;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    abbr[title]::after {
        content: " (" attr(title) ")";
    }
}

/* ==========================================================================
   13. Dark Mode Support
   ========================================================================== */

/**
 * 다크 모드 지원
 * WCAG 2.1에서는 필수는 아니지만 사용자 경험 향상
 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
        /* 대비율: 12.6:1 */
    }

    a:not([class]) {
        color: #64b5f6;
        /* 대비율: 7.5:1 (어두운 배경) */
    }

    a:not([class]):hover,
    a:not([class]):focus {
        color: #90caf9;
    }

    .btn-primary {
        background-color: #1976d2;
        color: #ffffff;
    }

    input,
    textarea,
    select {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }

    [role="dialog"],
    [role="alertdialog"] {
        background-color: #2a2a2a;
        color: #e0e0e0;
    }
}

/* ==========================================================================
   14. Text Spacing (WCAG 2.1 - 1.4.12)
   ========================================================================== */

/**
 * 텍스트 간격 조정 가능하도록 설정
 * .text-spacing 클래스가 적용된 영역에만 적용
 */
.text-spacing,
.text-spacing * {
    line-height: 1.5 !important;
    letter-spacing: 0.12em !important;
}

.text-spacing p {
    margin-bottom: 2em !important;
}

.text-spacing h1,
.text-spacing h2,
.text-spacing h3,
.text-spacing h4,
.text-spacing h5,
.text-spacing h6 {
    line-height: 1.2 !important;
    margin-bottom: 0.5em !important;
}

/* ==========================================================================
   15. Utility Classes
   ========================================================================== */

/**
 * 시각적으로 숨김 (스크린 리더는 읽음)
 */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/**
 * 포커스 가능한 숨김 요소
 */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/**
 * 포커스 표시 강화
 */
.focus-visible:focus-visible {
    outline: 4px solid #4CAF50 !important;
    outline-offset: 4px !important;
}

/* ===================================
   Remove Focus Outlines (사용자 화면)
   =================================== */

/**
 * 모든 포커스 outline 제거
 */
*:focus,
*:focus-visible,
*:focus-within {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

.btn:focus,
.btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    border-color: inherit !important;
    box-shadow: none !important;
}

/**
 * 클릭 시 밑줄 제거
 */
a:active,
a:focus,
a:focus-visible {
    text-decoration: none !important;
}

/* ===================================
   yeol 추가
   =================================== */

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-load {
    animation-name: slideInFromBottom;
    animation-timing-function: cubic-bezier(0.2, 0, 0.2, 1);
    animation-fill-mode: forwards;
    animation-play-state: running;
    animation-duration: 1s;
    opacity: 0;
}


/*  quick-menu  */
.fade-in {
    animation: fadeIn 0.2s ease-out forwards;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float-slow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-float-slow {
    animation: float-slow 4s ease-in-out infinite;
}

.nanum-pen-script-regular {
    font-family: "Nanum Pen Script", cursive;
    font-weight: 400;
    font-style: normal;
}

.hi-melody-regular {
    font-family: "Hi Melody", sans-serif;
    font-weight: 400;
    font-style: normal;
}

#quick-menu:has(#schedule-popup:not(.hidden)) .quick-menu-list {
    opacity: 0 !important;
    vertical-align: hidden !important;
    visibility: hidden !important;
    transform: translateY(16px) scale(0.95) !important;
}

#schedule-popup:hover~.quick-menu-list {
    opacity: 0 !important;
    visibility: hidden !important;
}

#schedule-popup {
    isolation: isolate;
}

.material-symbols-outlined {
    font-variation-settings: 'wght' 300, 'opsz' 24;
}

.hover\:border-primary-500\! {
  &:hover {
    @media (hover: hover) {
      border-color: var(--color-primary-500) /* #139d92 */ !important;
    }
  }
}