/**
 * Barrier-Free Visitor Guide Styles
 * WCAG AAA 기준 (명도 대비 7:1 이상)
 * 장애인 접근성 최적화
 */

/* ========== 변수 정의 ========== */
:root {
    /* WCAG AAA 색상 (명도 대비 7:1 이상) */
    --bf-primary-bg: #005A9C;
    --bf-primary-text: #FFFFFF;
    
    --bf-secondary-bg: #D35400;
    --bf-secondary-text: #FFFFFF;
    
    --bf-success-bg: #197419;
    --bf-success-text: #FFFFFF;
    
    --bf-warning-bg: #9C5700;
    --bf-warning-text: #FFFFFF;
    
    --bf-danger-bg: #A00000;
    --bf-danger-text: #FFFFFF;
    
    --bf-neutral-bg: #4A4A4A;
    --bf-neutral-text: #FFFFFF;
    
    /* 터치 영역 최소 크기 (48dp + 안전 여유) */
    --bf-min-touch: 64px;
    
    /* 글자 크기 */
    --bf-font-title: 3.5rem;    /* 56px */
    --bf-font-button: 2.25rem;  /* 36px */
    --bf-font-body: 1.5rem;     /* 24px */
    --bf-font-large: 4rem;      /* 64px */
    
    /* 간격 */
    --bf-spacing-sm: 1rem;
    --bf-spacing-md: 1.5rem;
    --bf-spacing-lg: 2rem;
    --bf-spacing-xl: 3rem;
}

/* ========== 방문자 안내 모드 스타일 ========== */
/* 방문자 안내에서는 사이드바를 항상 숨겨두고, 햄버거 메뉴로만 여닫기 */
body.visitor-guide-mode #mobileSidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 50;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

body.visitor-guide-mode #mobileSidebar.open {
    transform: translateX(0);
}

/* 메인 영역 전체 너비 사용 */
body.visitor-guide-mode main {
    overflow: hidden !important;
    height: calc(100vh - 80px) !important;
    padding: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
}

body.visitor-guide-mode #visitorGuideContainer {
    height: 100%;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden !important;
}

/* ========== 컨테이너 ========== */
.bf-container {
    width: 100%;
    padding: var(--bf-spacing-lg);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.bf-container-fixed {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden !important;
}

.bf-page-title {
    font-size: var(--bf-font-large);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--bf-spacing-xl);
    color: #1a1a1a;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.bf-destination-header .bf-page-title {
    margin-bottom: 0;
    flex: 0 1 auto;
    max-width: calc(100% - 240px);
}

/* ========== 층 선택 카드 ========== */
.bf-floor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--bf-spacing-lg);
    width: 100%;
    padding: var(--bf-spacing-md);
    overflow-y: hidden;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.bf-floor-grid::-webkit-scrollbar {
    width: 16px;
}

.bf-floor-grid::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
}

.bf-floor-grid::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
}

.bf-floor-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

.bf-floor-card {
    width: 350px;
    height: 350px;
    min-width: 350px;
    min-height: 350px;
    max-width: 350px;
    max-height: 350px;
    aspect-ratio: 1;
    border: 5px solid #000;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: var(--bf-font-title);
    font-weight: 700;
    color: var(--bf-primary-text);
    transition: box-shadow 0.3s ease, border-width 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    flex-shrink: 0;
    box-sizing: border-box;
}

.bf-floor-card:hover,
.bf-floor-card:focus {
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
    border-width: 6px;
}

.bf-floor-card:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

.bf-floor-card:active {
    /* 클릭 시 크기 변화 없음 */
}

/* 층별 색상 및 패턴 */
.bf-floor-1 {
    background-color: var(--bf-primary-bg);
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.bf-floor-2 {
    background-color: var(--bf-secondary-bg);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.bf-floor-3 {
    background-color: var(--bf-success-bg);
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.bf-floor-4 {
    background-color: var(--bf-warning-bg);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}


/* ========== 목적지 선택 화면 ========== */
.bf-destination-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bf-spacing-md);
    padding: var(--bf-spacing-lg);
    flex-shrink: 0;
    background: #fff;
    min-width: 0;
    overflow: hidden !important;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
    position: relative;
}

.bf-back-button {
    position: absolute;
    left: var(--bf-spacing-lg);
    width: auto;
    min-width: 200px;
    padding: 0 var(--bf-spacing-md);
    height: var(--bf-min-touch);
    min-height: var(--bf-min-touch);
    background-color: var(--bf-neutral-bg);
    color: var(--bf-neutral-text);
    border: 4px solid #000;
    border-radius: 16px;
    font-size: var(--bf-font-button);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.bf-back-button:hover,
.bf-back-button:focus {
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.bf-back-button:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

/* ========== 목적지 카드 스크롤 ========== */
.bf-destination-scroll {
    display: flex;
    flex-direction: row;
    gap: var(--bf-spacing-lg);
    padding: var(--bf-spacing-lg);
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
}

.bf-destination-scroll::-webkit-scrollbar {
    height: 16px;
}

.bf-destination-scroll::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
}

.bf-destination-scroll::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
}

.bf-destination-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

.bf-destination-card {
    min-width: 308px;
    width: 308px;
    max-width: 308px;
    min-height: 308px;
    height: 308px;
    max-height: 308px;
    flex-shrink: 0;
    border: 5px solid #000;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--bf-spacing-md);
    scroll-snap-align: start;
    transition: box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    box-sizing: border-box;
    overflow: hidden;
}

.bf-destination-card:hover,
.bf-destination-card:focus {
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.bf-destination-card:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

/* 목적지별 색상 및 패턴 (최대 6개 색상 순환) */
.bf-dest-1 { 
    background-color: var(--bf-primary-bg); 
    color: var(--bf-primary-text);
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}
.bf-dest-2 { 
    background-color: var(--bf-secondary-bg); 
    color: var(--bf-secondary-text);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}
.bf-dest-3 { 
    background-color: var(--bf-success-bg); 
    color: var(--bf-success-text);
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}
.bf-dest-4 { 
    background-color: var(--bf-warning-bg); 
    color: var(--bf-warning-text);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}
.bf-dest-5 { 
    background-color: var(--bf-danger-bg); 
    color: var(--bf-danger-text);
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 5px,
        rgba(255,255,255,0.1) 5px,
        rgba(255,255,255,0.1) 10px
    );
}
.bf-dest-6 { 
    background-color: var(--bf-neutral-bg); 
    color: var(--bf-neutral-text);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255,255,255,0.1) 5px,
        rgba(255,255,255,0.1) 10px
    );
}

.bf-destination-name {
    font-size: var(--bf-font-button);
    font-weight: 700;
    text-align: center;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-width: 100%;
}

/* ========== 확인 모달 ========== */
.bf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--bf-spacing-md);
}

.bf-modal-content {
    background: #FFFFFF;
    border: 6px solid #000;
    border-radius: 24px;
    padding: var(--bf-spacing-xl);
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.bf-modal-title {
    font-size: var(--bf-font-title);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--bf-spacing-sm);
    color: #1a1a1a;
}

.bf-modal-destination {
    font-size: var(--bf-font-button);
    text-align: center;
    color: var(--bf-primary-bg);
    margin-bottom: var(--bf-spacing-xl);
    font-weight: 600;
}

.bf-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--bf-spacing-md);
}

.bf-button {
    min-width: 100%;
    min-height: var(--bf-min-touch);
    font-size: var(--bf-font-button);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.bf-button:hover,
.bf-button:focus {
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.bf-button:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

.bf-button:active {
    /* 클릭 시 크기 변화 없음 */
}

.bf-button-confirm {
    background-color: var(--bf-success-bg);
    color: var(--bf-success-text);
}

.bf-button-cancel {
    background-color: var(--bf-neutral-bg);
    color: var(--bf-neutral-text);
}

/* ========== 로딩 상태 ========== */
.bf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--bf-spacing-md);
    padding: var(--bf-spacing-xl);
}

.bf-spinner {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(0,0,0,0.1);
    border-top-color: var(--bf-primary-bg);
    border-radius: 50%;
    animation: bf-spin 1s linear infinite;
}

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

.bf-loading-text {
    font-size: var(--bf-font-button);
    font-weight: 600;
    color: #1a1a1a;
}

/* ========== 반응형 디자인 ========== */
/* 세로가 매우 긴 화면 (세로 스크롤) - 세로 모드 태블릿 등 */
@media (max-height: 600px) and (orientation: portrait) {
    .bf-destination-scroll {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: calc(100vh - 200px);
        scroll-snap-type: y mandatory;
    }
    
    .bf-destination-card {
        min-width: 100%;
        width: 100%;
        max-width: 100%;
    }
    
    .bf-destination-scroll::-webkit-scrollbar {
        width: 16px;
        height: auto;
    }
}

/* 모바일 및 작은 화면 */
@media (max-width: 768px) {
    .bf-container {
        padding: var(--bf-spacing-md);
    }
    
    .bf-floor-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--bf-spacing-md);
    }
    
    .bf-floor-card {
        width: 280px;
        height: 280px;
        min-width: 280px;
        min-height: 280px;
        max-width: 280px;
        max-height: 280px;
    }
    
    .bf-destination-card {
        min-width: 220px;
        width: 220px;
        max-width: 220px;
        min-height: 220px;
        height: 220px;
        max-height: 220px;
    }
    
    .bf-modal-content {
        padding: var(--bf-spacing-lg);
    }
}

/* ========== 접근성: 고대비 모드 지원 ========== */
@media (prefers-contrast: high) {
    .bf-floor-card,
    .bf-destination-card,
    .bf-button,
    .bf-back-button {
        border-width: 6px;
    }
}

/* ========== 접근성: 애니메이션 감소 ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== 프린트 스타일 ========== */
@media print {
    .bf-container {
        background: white;
    }
    
    .bf-button,
    .bf-back-button {
        border: 2px solid #000;
    }
}

