/* 주문 취합 전용 스타일 (order_mng.css 보완) */

.summary-content-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.order-page-wrapper {
    height: 100%;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 8px;
    padding-bottom: 10px;
    width: 100%;
}

/* 타이틀 여백 최소화 */
.order-page-wrapper .visual_tit {
    margin-bottom: 0;
}

.order-page-wrapper .visual_tit h1 {
    font-size: 18px;
    margin-bottom: 0;
    line-height: 1.3;
}

/* 요약 카드 영역 (미니 요약 카드로 리디자인 및 그리드 헤더 삽입) */
.mini-summary-container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.mini-summary-title {
    font-size: 12.5px;
    font-weight: 800;
    color: #111;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.mini-summary-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 12px;
    background-color: #f26522;
    border-radius: 2px;
}

.mini-summary-items {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mini-card-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 11px;
}

.mini-card-item .label {
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 10.5px;
    display: inline-block;
    line-height: 1.2;
}

.mini-card-item.bob .label {
    background-color: #ffe4e6;
    color: #e11d48;
}

.mini-card-item.pull .label {
    background-color: #dcfce7;
    color: #166534;
}

.mini-card-item.total .label {
    background-color: #f3f4f6;
    color: #374151;
}

.mini-card-item .count {
    font-weight: 800;
    color: #000;
    font-size: 14px;
}



/* 필터 조건 스타일 보완 */
.filter-check {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #444;
}

.filter-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 그리드 내 입력창 스타일 */
.grid-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    text-align: center;
    font-size: 11px;
    transition: background-color 0.2s;
}

.grid-input:focus {
    outline: none;
    border-color: #f26522;
    box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.1);
}

/* 발열 수량 필드 (연한 주황) */
.grid-input.input-bob {
    background-color: #FFF7ED;
    width: 75px;
    font-weight: 700;
    color: #f26522;
}

.grid-input.input-bob:focus {
    border-color: #f26522;
    box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.2);
}

/* 그리드 내 텍스트에어리어 스타일 (이미지 기반) */
.grid-textarea {
    width: 100%;
    height: 28px;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    font-size: 11px;
    line-height: 1.4;
    color: #334155;
    resize: none;
    transition: background-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
    display: block;
    outline: none;
}

.grid-textarea:focus {
    border-color: #f26522;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.1);
}

.grid-textarea::placeholder {
    color: #cbd5e1;
}

/* 샐러드 수량 필드 (연한 초록) */
.grid-input.input-pull {
    background-color: #F0FDF4;
    width: 75px;
    font-weight: 700;
    color: #166534;
}

.grid-input.input-pull:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.grid-input.remark {
    text-align: left;
}

.grid-select {
    width: 100%;
    padding: 4px 6px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background-color: #fff;
    font-size: 11px;
}

.dirty-row {
    background-color: #fffbe6 !important;
}

/* 셀 텍스트 정렬 유틸리티 */
.cell-center { text-align: center !important; }
.cell-left   { text-align: left !important; }
.cell-right  { text-align: right !important; }

/* 정렬 아이콘 활성화 스타일 */
th.sort-active {
    color: #f26522 !important;
}
th.sort-active i {
    opacity: 1 !important;
}

/* 날짜 입력창 스타일 */
.clickable-date-input {
    cursor: pointer;
    font-weight: 500;
    background-color: #fff !important;
}

/* visual_tit 하단 설명 스타일 */
.visual_tit h4 {
    font-size: 14px;
    color: #6b7280;
    margin-top: 4px;
    font-weight: 500;
}

/* --- 변경 로그 모달 스타일 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.history-modal {
    background: #fff;
    width: 480px;
    max-height: 85vh;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-up 0.3s ease-out;
}

@keyframes modal-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 32px 32px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-title-group {
    text-align: center;
}

.modal-sub-title {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.modal-main-title {
    font-size: 22px;
    color: #1e293b;
    font-weight: 800;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    flex: 1;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #edf2f7;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.history-type-badge {
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.history-date {
    font-size: 12px;
    color: #94a3b8;
}

.history-content {
    font-size: 13.5px;
    color: #334155;
    font-weight: 400;
    line-height: 1.4;
}

/* 강조 텍스트 */
.history-content strong {
    font-weight: 700;
    color: #0f172a;
    margin-right: 2px;
}

.history-content .highlight {
    color: #f26522;
    font-weight: 600;
}

.no-history {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

.modal-footer {
    padding: 24px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.btn-close-modal {
    padding: 12px 60px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* --- 주문취합 목록 그리드 상단 액션 버튼 스타일 --- */
.grid-actions {
    display: flex;
    gap: 8px;
}

.grid-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 26px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.grid-actions .btn-save {
    background: var(--primary-orange);
    color: #fff;
    border-color: var(--primary-orange);
}

.grid-actions .btn-copy-last-qty {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

.grid-actions .btn-copy-last-qty:hover {
    background: #059669;
    border-color: #059669;
    opacity: 0.9;
}

.grid-actions .btn-save:hover {
    background: #d84b0d;
    border-color: #d84b0d;
    opacity: 0.9;
}

.grid-actions .btn-generate {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.grid-actions .btn-generate:hover {
    background: #096dd9;
    border-color: #096dd9;
    opacity: 0.9;
}

.grid-actions .btn-delete {
    background: #fff;
    border: 1px solid #111;
    color: #111;
}

.grid-actions .btn-delete:hover {
    background: #f9fafb;
}

.grid-actions .btn-excel-down:hover {
    background: #059669 !important;
    border-color: #059669 !important;
}

.grid-actions .btn-excel-up:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

.grid-actions .btn-icon-svg {
    margin-right: 2px;
}

/* 주문취합 그리드 영역 하단 꽉 채우기 */
.order-page-wrapper .grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
    height: 100dvb;
}

.order-page-wrapper .grid-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.order-page-wrapper .orders-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.grid-input[readonly],
.grid-input:read-only,
.grid-select[disabled],
.grid-textarea[readonly],
.grid-textarea:read-only {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
}

/* --- 일괄 기사 배정 스타일 --- */
.batch-driver-assign {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.batch-driver-select {
    height: 24px;
    min-width: 100px;
    padding: 0 6px;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    background-color: #eff6ff;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.batch-driver-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.batch-driver-select:hover {
    background-color: #dbeafe;
}

.btn-batch-assign {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    white-space: nowrap;
}

.btn-batch-assign:hover {
    background: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-batch-assign:active {
    transform: scale(0.97);
}

/* --- 최상단(조회조건 아래) 글로벌 액션 버튼 스타일 --- */
.global-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 4px;
    margin-top: 4px; /* 간격 확보 */
    position: relative;
    min-height: 26px; /* 버튼 숨김 시에도 높이 유지 */
}

.action-buttons-group {
    display: flex;
    gap: 6px;
}

.btn-global-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 26px; /* 최소 높이 */
    padding: 0 10px; /* 좌우 여백 축소 */
    border-radius: 6px;
    font-size: 11px; /* 폰트 조정 */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-global-action.btn-large-order {
    background: #4f46e5;
    color: #ffffff;
}

.btn-global-action.btn-large-order:hover {
    background: #4338ca;
}

.btn-global-action.btn-save {
    background: var(--primary-orange, #FF5117);
    color: #fff;
}

.btn-global-action.btn-save:hover {
    opacity: 0.9;
}

.btn-global-action.btn-delete {
    background: #fff;
    border: 1px solid #111;
    color: #111;
}

.btn-global-action.btn-delete:hover {
    background: #f9fafb;
}

.btn-global-action.btn-assign-driver {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.btn-global-action.btn-assign-driver:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #94a3b8;
}

/* --- 기사 배정 모달 전용 스타일 (3단 셔틀 UI) --- */
.driver-assign-modal {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
}

.driver-assign-body {
    display: flex;
    flex-direction: row;
    gap: 12px;
    padding: 16px;
    background: #f1f5f9;
    overflow: hidden; /* 스크롤은 개별 패널에서 */
}

/* 3단 분할 패널 영역 */
.da-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.da-left {
    flex: 0 0 220px; /* 고정 너비 */
}

.da-center {
    flex: 1;
    min-width: 0;
}

.da-right {
    flex: 1;
    min-width: 0;
}

.da-panel-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.da-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* 셔틀 이동 버튼 영역 */
.da-shuttle-controls {
    flex: 0 0 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.btn-shuttle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-shuttle:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #94a3b8;
    transform: scale(1.05);
}

.btn-shuttle:active {
    transform: scale(0.95);
}

.btn-shuttle-right:hover {
    color: #3b82f6;
    border-color: #3b82f6;
    background: #eff6ff;
}

.btn-shuttle-left:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: #fef2f2;
}

/* 기사 목록 아이템 (좌측 패널) */
.da-driver-item {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.da-driver-item:hover {
    background: #f8fafc;
}

.da-driver-item.selected {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.da-driver-name {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.da-driver-item.selected .da-driver-name {
    color: #1d4ed8;
}

.da-driver-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.da-driver-count {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.da-driver-qty {
    font-size: 10px;
    color: #94a3b8;
}
.da-driver-item.selected .da-driver-count {
    color: #2563eb;
}

/* 모달 내 그리드 (중앙/우측 패널) 11px 적용 */
.da-table {
    width: 100%;
    border-collapse: collapse;
}

.da-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-align: center;
    z-index: 1;
}

.da-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 11px;
    color: #334155;
    vertical-align: middle;
}

.da-table tr:hover td {
    background: #f8fafc;
}

/* 11px 인풋/텍스트에어리어 오버라이드 */
.da-table .grid-input,
.da-table .grid-textarea {
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 4px;
    min-height: 22px;
    height: 22px;
}

.da-table .grid-textarea {
    resize: none;
    overflow: hidden;
}

/* 애니메이션/트랜지션 효과 클래스 */
.row-transfer-anim {
    animation: highlight-row 1s ease;
}

@keyframes highlight-row {
    0% { background-color: #dbeafe; }
    100% { background-color: transparent; }
}

/* 기사 미배정 뱃지 스타일 */
.unassigned-badge {
    margin-left: 10px;
    font-size: 13px;
    font-weight: 800;
    color: #ef4444;
    vertical-align: middle;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
}

/* 상단 인라인 경고 배너 스타일 (대안 C) */
.unassigned-alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    border-left: 4px solid #ef4444;
    padding: 8px 16px;
    border-radius: 8px;
    margin-top: 4px;
    margin-bottom: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: #991b1b;
    box-sizing: border-box;
    animation: slide-down 0.25s ease-out;
}

.unassigned-alert-banner .banner-icon {
    font-size: 15px;
}

.unassigned-alert-banner .banner-text {
    line-height: 1.4;
}

.unassigned-alert-banner .btn-banner-action {
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    white-space: nowrap;
}

.unassigned-alert-banner .btn-banner-action:hover {
    background-color: #dc2626;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.unassigned-alert-banner .btn-banner-action:active {
    transform: scale(0.97);
}

@keyframes slide-down {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ----- 반응형 ----- */
@media (max-width: 1024px) {
    .grid-actions {
        display: none !important;
    }

    .search-area {
        width: 100%;
        background: #fff;
        padding: 12px 16px;
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        gap: 12px;
        align-items: flex-start;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .global-actions {
        z-index: 999;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
    }
    .mini-summary-items {
        display: flex;
        gap: 8px;
        align-items: center;
        position: initial;
    }
    .mini-summary-container {
        display: flex;
        align-items: center;
        gap: 12px;
        position: initial;
        left: initial;
        transform: initial;
    }

    .action-buttons-group {
        display: flex;
        gap: 6px;
        width: 100%;
    }
    .action-buttons-group button {
        width: 100%;
        padding: 20px 20px;
        font-size: 1.4rem;
    }
    .action-buttons-group button .btn-icon-svg {
        transform: scale(1.1);
    }
    .btn-assign-driver {
        width: 100%;
        padding: 14px 16px;
    }
    .grid-title {
        white-space: nowrap;
    }

    .search-input,
    .comp-name,
    .grid-input,
    .grid-textarea {
        font-size: 15px !important;
    }
    .comp-name {
        text-align: center !important;
    }
    .orders-table .grid-textarea {
        width: 200px;
        height: 100%;
    }
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: initial;
        backdrop-filter: blur(4px);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2000;
    }

    .search-area {
        background: initial;
        padding: 0;
        border-radius: 10px;
        box-shadow: initial;
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        gap: 6px;
        align-items: flex-start;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    /* 취합목록 폰트사이즈 */
    .search-row .search-input, 
    .search-row .comp-name, 
    .search-row .grid-input, 
    .search-row .grid-textarea {
        font-size: 11px !important;
    }
    .grid-scroll .search-input, 
    .grid-scroll .comp-name, 
    .grid-scroll .grid-input, 
    .grid-scroll .grid-textarea {
        font-size: 12px !important;
    }
    /* 취합 목록(밥.풀 상자 사이즈) */
    .grid-input.input-bob,
    .grid-input.input-pull  {
        width: 40px;
    }
    .orders-table thead tr th:nth-child(2),
    #summaryTableBody tr td:nth-child(2) {
        display: none;
    }
    
}
@media (max-width: 400px) {
    .search-btns {
        gap: 4px !important;
    }
    .search-btns .btn-primary,
    .search-btns .btn-reset {
        border-radius: 8px;
        width: 60px;
        height: 30px;
        padding: 4px 6px;
        font-size: 10px;
        gap: 1px;
    }
    .btn-icon-svg {
        width: 12px;
        height: 12px;
        margin-right: 2px;
        vertical-align: middle;
        display: inline-block;
        stroke: currentColor;
        fill: none;
        transform: translateY(-1px);
    }
    .filter-check {
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 4px;
        color: #444;
        white-space: wrap;
    }
}