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

/* ========== 변수 정의 ========== */
:root {
    /* WCAG AAA 색상 (명도 대비 7:1 이상) */
    --bo-received-bg: #197419;      /* 접수됨 (초록) */
    --bo-received-text: #FFFFFF;
    
    --bo-completed-bg: #4A4A4A;     /* 완료됨 (회색) */
    --bo-completed-text: #FFFFFF;
    
    --bo-cancelled-bg: #666666;     /* 취소됨 (회색) */
    --bo-cancelled-text: #FFFFFF;
    
    --bo-pickup-bg: #005A9C;        /* 픽업주문 (파란색) */
    --bo-pickup-text: #FFFFFF;
    
    --bo-delivery-bg: #D35400;      /* 로봇배송 (주황색) */
    --bo-delivery-text: #FFFFFF;
    
    --bo-danger-bg: #A00000;        /* 위험/삭제 (빨강) */
    --bo-danger-text: #FFFFFF;
    
    /* 터치 영역 최소 크기 (48dp + 안전 여유) */
    --bo-min-touch: 64px;
    
    /* 글자 크기 */
    --bo-font-title: 4rem;          /* 64px */
    --bo-font-large: 3rem;          /* 48px */
    --bo-font-medium: 2.5rem;       /* 40px */
    --bo-font-normal: 2rem;         /* 32px */
    --bo-font-small: 1.75rem;       /* 28px */
    
    /* 간격 */
    --bo-spacing-sm: 1rem;
    --bo-spacing-md: 1.5rem;
    --bo-spacing-lg: 2rem;
    --bo-spacing-xl: 3rem;
}

/* ========== 바리스타 주문 관리 모드 스타일 ========== */
/* 바리스타 페이지에서는 사이드바를 항상 햄버거로 표시 */
body.barista-order-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.barista-order-mode #mobileSidebar.open {
    transform: translateX(0);
}

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

body.barista-order-mode #baristaOrderContainer {
    height: 100%;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden !important;
}

/* ========== 컨테이너 ========== */
.bo-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    background: #f5f5f5;
}

/* ========== 탭 네비게이션 ========== */
.bo-tabs {
    display: flex;
    gap: var(--bo-spacing-md);
    padding: var(--bo-spacing-lg);
    background: #fff;
    border-bottom: 4px solid #e0e0e0;
    flex-shrink: 0;
}

.bo-tab-button {
    flex: 1;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-medium);
    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;
    background: #e0e0e0;
    color: #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.bo-tab-button.active {
    background: var(--bo-received-bg);
    color: var(--bo-received-text);
    border-width: 5px;
}

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

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

/* ========== 주문 현황 페이지 ========== */
.bo-current-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.bo-current-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--bo-spacing-lg);
    background: #fff;
    border-bottom: 3px solid #e0e0e0;
    flex-shrink: 0;
}

.bo-current-title {
    font-size: var(--bo-font-large);
    font-weight: 700;
    color: #1a1a1a;
}

.bo-delete-all-button {
    min-width: 200px;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-normal);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    background: var(--bo-danger-bg);
    color: var(--bo-danger-text);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    padding: 0 var(--bo-spacing-md);
}

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

.bo-delete-all-button:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

/* ========== 주문 카드 스크롤 영역 ========== */
.bo-cards-scroll {
    display: flex;
    flex-direction: row;
    gap: var(--bo-spacing-lg);
    padding: var(--bo-spacing-lg);
    padding-bottom: calc(var(--bo-spacing-lg) + 10vh); /* 하단 여백 10% 추가 */
    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);
    height: calc(100vh - 200px);
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
}

/* 빈 상태일 때 중앙 정렬 */
.bo-cards-scroll:has(.bo-empty-state) {
    justify-content: center;
    align-items: center;
}

.bo-cards-scroll::-webkit-scrollbar {
    height: 16px;
}

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

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

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

/* ========== 주문 카드 ========== */
.bo-order-card {
    min-width: 400px;
    width: 400px;
    max-width: 400px;
    height: 500px;
    min-height: 500px;
    max-height: 500px;
    flex-shrink: 0;
    border: 5px solid #000;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    padding: var(--bo-spacing-lg);
    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;
    position: relative;
    overflow: hidden;
}

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

.bo-order-card:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

/* 주문 상태별 색상 및 패턴 */
.bo-order-card.received {
    background-color: var(--bo-received-bg);
    color: var(--bo-received-text);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.bo-order-card.completed {
    background-color: var(--bo-completed-bg);
    color: var(--bo-completed-text);
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

.bo-order-card.cancelled {
    background-color: var(--bo-cancelled-bg);
    color: var(--bo-cancelled-text);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
}

/* 카드 내용 */
.bo-card-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--bo-spacing-sm) * 0.5);
    padding-bottom: calc(var(--bo-spacing-sm) * 0.5);
    border-bottom: 3px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.bo-header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--bo-spacing-sm) * 0.35);
}

.bo-order-number {
    font-size: calc(var(--bo-font-medium) * 0.8);
    font-weight: 700;
}

.bo-order-time {
    font-size: var(--bo-font-small);
    font-weight: 600;
}

.bo-order-poi {
    font-size: var(--bo-font-medium);
    font-weight: 700;
}

.bo-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--bo-spacing-sm);
    min-height: 0;
    overflow: hidden;
}

.bo-order-type-badge {
    display: inline-block;
    padding: 0.5rem var(--bo-spacing-md);
    border-radius: 12px;
    font-size: var(--bo-font-small);
    font-weight: 700;
    text-align: center;
    border: 3px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
    height: auto;
    line-height: 1.4;
}

.bo-order-type-badge.pickup {
    background-color: var(--bo-pickup-bg);
    color: var(--bo-pickup-text);
}

.bo-order-type-badge.delivery {
    background-color: var(--bo-delivery-bg);
    color: var(--bo-delivery-text);
}

.bo-order-details {
    font-size: calc(var(--bo-font-normal) * 0.846);
    line-height: 1.4;
    padding: var(--bo-spacing-sm);
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 220px;
}

.bo-order-details::-webkit-scrollbar {
    width: 8px;
}

.bo-order-details::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.bo-order-details::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.bo-order-item {
    display: flex;
    align-items: center;
    gap: var(--bo-spacing-sm);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.bo-order-item-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.bo-order-item-more {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    padding: var(--bo-spacing-sm);
    margin-top: var(--bo-spacing-sm);
    opacity: 0.8;
    flex-shrink: 0;
}

.bo-card-footer {
    margin-top: auto;
    padding-top: var(--bo-spacing-sm);
    border-top: 3px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.bo-complete-button {
    width: 100%;
    min-height: 56px;
    height: 56px;
    font-size: var(--bo-font-normal);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    background: rgba(255,255,255,0.9);
    color: #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bo-complete-button:hover,
.bo-complete-button:focus {
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
    background: rgba(255,255,255,1);
}

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

.bo-complete-button.completed {
    background: var(--bo-completed-bg);
    color: var(--bo-completed-text);
}

.bo-complete-button.cancelled {
    background: var(--bo-cancelled-bg);
    color: var(--bo-cancelled-text);
}

/* ========== 주문 로그 페이지 ========== */
.bo-logs-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--bo-spacing-lg);
    min-height: 0;
}

.bo-logs-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--bo-spacing-md);
    margin-bottom: var(--bo-spacing-lg);
    flex-wrap: wrap;
}

.bo-filters-left {
    display: flex;
    gap: var(--bo-spacing-md);
    flex-wrap: wrap;
}

.bo-filter-select {
    min-width: 200px;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-normal);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    background: #fff;
    color: #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    padding: 0 var(--bo-spacing-md);
    cursor: pointer;
}

.bo-filter-select:focus {
    outline: 4px dashed #FFD700;
    outline-offset: 4px;
}

.bo-filter-button {
    min-width: 120px;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-normal);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    background: #e0e0e0;
    color: #333;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    padding: 0 var(--bo-spacing-md);
}

.bo-filter-button.active {
    background: var(--bo-received-bg);
    color: var(--bo-received-text);
}

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

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

.bo-download-button {
    min-width: 200px;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-normal);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    background: var(--bo-received-bg);
    color: var(--bo-received-text);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    padding: 0 var(--bo-spacing-md);
}

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

.bo-logs-table-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    background: #fff;
    border-radius: 16px;
    padding: var(--bo-spacing-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.bo-logs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.bo-logs-table th {
    background: var(--bo-received-bg);
    color: var(--bo-received-text);
    font-size: var(--bo-font-normal);
    font-weight: 700;
    padding: var(--bo-spacing-md);
    text-align: left;
    border-bottom: 4px solid #000;
    position: sticky;
    top: 0;
    z-index: 10;
}

.bo-logs-table td {
    font-size: var(--bo-font-small);
    padding: var(--bo-spacing-md);
    border-bottom: 2px solid #e0e0e0;
}

.bo-logs-table tr:hover {
    background: rgba(25, 116, 25, 0.1);
}

/* ========== 모달 ========== */
.bo-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(--bo-spacing-md);
}

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

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

.bo-modal-message {
    font-size: var(--bo-font-normal);
    text-align: center;
    color: #333;
    margin-bottom: var(--bo-spacing-xl);
}

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

.bo-modal-button {
    min-width: 100%;
    min-height: var(--bo-min-touch);
    font-size: var(--bo-font-medium);
    font-weight: 700;
    border: 4px solid #000;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.bo-modal-button.confirm {
    background: var(--bo-received-bg);
    color: var(--bo-received-text);
}

.bo-modal-button.cancel {
    background: #e0e0e0;
    color: #333;
}

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

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

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

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

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

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

/* ========== 빈 상태 ========== */
.bo-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--bo-spacing-xl);
    min-height: 400px;
    width: 100%;
    text-align: center;
}

.bo-empty-icon {
    font-size: 5rem;
    margin-bottom: var(--bo-spacing-lg);
}

.bo-empty-text {
    font-size: var(--bo-font-large);
    color: #666;
    text-align: center;
}

/* ========== 반응형 디자인 ========== */
@media (max-width: 768px) {
    :root {
        --bo-font-title: 3rem;
        --bo-font-large: 2.5rem;
        --bo-font-medium: 2rem;
        --bo-font-normal: 1.75rem;
        --bo-font-small: 1.5rem;
    }
    
    .bo-order-card {
        min-width: 320px;
        width: 320px;
        max-width: 320px;
        min-height: 450px;
    }
    
    .bo-logs-page {
        padding: var(--bo-spacing-md);
    }
}

/* ========== 접근성: 고대비 모드 지원 ========== */
@media (prefers-contrast: high) {
    .bo-order-card,
    .bo-tab-button,
    .bo-complete-button,
    .bo-filter-button,
    .bo-modal-button {
        border-width: 6px;
    }
}

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

