/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #3C1E1E, #5a2d2d);
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: #FEE500;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    padding: 10px 0;
    display: block;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2px;
}

.nav-menu li a {
    color: #fff;
    text-decoration: none;
    padding: 10px 12px;
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-menu li a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: #FEE500;
}

.nav-menu li a.active {
    background: rgba(254, 229, 0, 0.15);
    border-bottom-color: #FEE500;
    color: #FEE500;
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown .dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    min-width: 160px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    list-style: none;
    z-index: 200;
    overflow: hidden;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.active .dropdown-menu {
    display: block;
}

.nav-dropdown .dropdown-menu li a {
    color: #333;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.nav-dropdown .dropdown-menu li:last-child a {
    border-bottom: none;
}

.nav-dropdown .dropdown-menu li a:hover {
    background: #FEE500;
    color: #3C1E1E;
}

.nav-dropdown .dropdown-menu li a.active {
    background: #fff3cd;
    color: #3C1E1E;
    font-weight: 600;
}

.dropdown-divider {
    height: 1px;
    background: #ddd;
    margin: 0;
}

.dropdown-divider + li a {
    border-top: none !important;
}

/* Nav User */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 모바일 햄버거 메뉴 버튼 - 기본적으로 숨김 */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #FEE500;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    color: #fff;
    font-weight: 500;
    font-size: 0.85rem;
}

.user-role {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-role.role-admin {
    background: #FEE500;
    color: #3C1E1E;
}

.user-role.role-user {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-logout {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Page Header (legacy) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #FEE500, #FFD700);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    color: #3C1E1E;
    font-size: 1.8rem;
}

/* Compact Header - 통일된 컴팩트 헤더 스타일 */
.compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.compact-header .header-left,
.compact-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-header .filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-header .form-control {
    padding: 6px 10px;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.compact-header input[type="date"] {
    width: 130px;
}

.compact-header select {
    min-width: 90px;
}

.compact-header .search-input {
    padding: 6px 10px;
    font-size: 0.9rem;
    min-width: 150px;
}

.compact-header .stats-box {
    display: flex;
    gap: 10px;
}

.compact-header .stat-item {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: #f5f5f5;
}

.compact-header .stat-item.pending {
    background: #fff3cd;
    color: #856404;
}

.compact-header .stat-item.confirmed {
    background: #d4edda;
    color: #155724;
}

.compact-header .stat-item strong {
    margin-left: 3px;
}

@media (max-width: 768px) {
    .compact-header {
        flex-direction: column;
        align-items: stretch;
    }

    .compact-header .header-left,
    .compact-header .header-right {
        justify-content: center;
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #FEE500, #FFD700);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #3C1E1E;
    font-size: 1.8rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95rem;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3C1E1E, #5a2d2d);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4a2626, #6b3535);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #34c759);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #FEE500, #FFD700);
    color: #3C1E1E;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
    min-width: 60px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    color: #555;
}

.filter-group input[type="date"],
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.stats-box {
    margin-left: auto;
    display: flex;
    gap: 15px;
}

.stat-item {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    background-color: #f0f0f0;
}

.stat-item.pending {
    background-color: #fff3cd;
    color: #856404;
}

.stat-item.confirmed {
    background-color: #d4edda;
    color: #155724;
}

.stat-item.cancelled {
    background-color: #f8d7da;
    color: #721c24;
}

/* Status Filter Buttons */
.status-filter-group {
    display: flex;
    gap: 6px;
}

.status-filter-group.spaced {
    gap: 10px;
    margin-right: 20px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-status-filter {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.btn-status-filter:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-status-filter.active {
    background: #3C1E1E;
    color: #FEE500;
    border-color: #3C1E1E;
}

.btn-status-filter[data-status="pending"].active {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.btn-status-filter[data-status="confirmed"].active {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.btn-status-filter[data-status="cancelled"].active {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

.btn-status-filter span {
    font-weight: 700;
    margin-left: 2px;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background: white;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bulk-actions-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Order List */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.empty-message {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    background: white;
    border-radius: 10px;
}

/* Order Card */
.order-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #FEE500;
    transition: all 0.2s;
}

.order-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.order-card.confirmed {
    border-left-color: #28a745;
    background-color: #f8fff9;
}

.order-card.cancelled {
    border-left-color: #dc3545;
    background-color: #fff8f8;
    opacity: 0.7;
}

.order-card.not-order {
    border-left-color: #6c757d;
    background-color: #f9f9f9;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.order-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.order-user-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.order-time {
    color: #888;
    font-size: 0.9rem;
}

.order-type-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.order-type-badge.new {
    background-color: #e3f2fd;
    color: #1565c0;
}

.order-type-badge.additional {
    background-color: #fff3e0;
    color: #ef6c00;
}

.order-type-badge.cancel {
    background-color: #ffebee;
    color: #c62828;
}

.order-type-badge.manual {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.order-raw-text {
    background: #f8f8f8;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-family: 'Noto Sans KR', sans-serif;
    color: #555;
    border-left: 3px solid #ddd;
}

.order-items {
    margin-bottom: 15px;
}

.order-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FEE500;
    padding: 8px 15px;
    border-radius: 20px;
    margin: 4px;
    font-weight: 500;
}

.order-item .item-name {
    color: #3C1E1E;
}

.order-item .item-qty {
    background: #3C1E1E;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.order-note {
    color: #666;
    font-size: 0.9rem;
    padding: 8px 12px;
    background: #fff9e6;
    border-radius: 6px;
    margin-bottom: 12px;
}

.order-note::before {
    content: "메모: ";
    font-weight: 600;
}

.not-order-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #856404;
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.order-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

/* 승인일시 - 하단 좌측 */
.order-actions .approval-time {
    margin-right: auto;
    font-size: 0.8rem;
    color: #666;
}

/* 주문번호 - 헤더 우측 */
.order-header .order-number-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1976D2;
    background: #e3f2fd;
    padding: 4px 10px;
    border-radius: 12px;
}

.order-status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.order-status-badge.confirmed {
    background-color: #28a745;
    color: white;
}

.order-status-badge.cancelled {
    background-color: #dc3545;
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #3C1E1E, #5a2d2d);
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 1.2rem;
    color: #FEE500;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #fff;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FEE500;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body .form-group label {
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    padding: 10px 12px;
    font-size: 0.95rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    border-radius: 0 0 20px 20px;
    flex-shrink: 0;
}

.modal-footer-right {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #3C1E1E;
    font-size: 0.9rem;
}

.form-group label span {
    font-weight: 400;
    color: #888;
    font-size: 0.8rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fafafa;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FEE500;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(254, 229, 0, 0.15);
}

.form-group input::placeholder {
    color: #aaa;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: #FEE500;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(254, 229, 0, 0.15);
}

.raw-text {
    background: #f5f5f5;
    padding: 12px 15px;
    border-radius: 8px;
    color: #666;
    font-style: italic;
}

/* Item Row */
.item-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* 직접 입력 모드 - 두 줄 레이아웃 */
.item-row.custom-mode {
    flex-wrap: wrap;
    padding: 15px;
    background: linear-gradient(135deg, #f8f5ff 0%, #fff5f8 100%);
    border: 2px dashed #d4a5ff;
    border-radius: 12px;
    position: relative;
    margin-bottom: 15px;
}

.item-row.custom-mode::before {
    content: '직접 입력';
    position: absolute;
    top: -10px;
    right: 12px;
    background: #7b1fa2;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

.item-row.custom-mode .first-line {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.item-row.custom-mode .second-line {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(123, 31, 162, 0.2);
}

.item-row.custom-mode .third-line {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    padding-top: 10px;
    margin-top: 5px;
}

.item-row.custom-mode .third-line label {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.item-row.custom-mode .item-price-input {
    width: 150px;
    padding: 8px 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.95rem;
}

.item-row.custom-mode .item-price-input:focus {
    outline: none;
    border-color: #FEE500;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.15);
}

.item-row.custom-mode .price-unit {
    font-size: 0.9rem;
    color: #666;
}

.item-row.custom-mode .item-name-input {
    flex: 1;
    min-width: 0;
}

.item-row.custom-mode .item-qty-input {
    width: 100px;
    flex-shrink: 0;
}

.item-row.custom-mode .btn-remove-item {
    flex-shrink: 0;
}

.item-row input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.item-row .item-select {
    flex: 2;
    min-width: 0;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.item-row .item-select:focus {
    outline: none;
    border-color: #FEE500;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.15);
}

.item-row .item-select:hover {
    border-color: #ccc;
}

.item-row .item-name-input {
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.95rem;
}

.item-row .item-name-input:focus {
    outline: none;
    border-color: #FEE500;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.15);
}

.item-row .item-qty-input {
    flex: 0 0 80px;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.95rem;
    text-align: center;
}

.item-row .item-qty-input:focus {
    outline: none;
    border-color: #FEE500;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.15);
}

.item-row .item-qty-input::placeholder {
    color: #aaa;
}

/* 필수값 에러 스타일 */
.item-row .item-select.error,
.item-row .item-name-input.error,
.item-row .item-qty-input.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.item-row .item-select.error:focus,
.item-row .item-name-input.error:focus,
.item-row .item-qty-input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.item-row .btn-remove-item {
    padding: 10px 14px;
    background: #ffebee;
    color: #c62828;
    border: 2px solid #ffcdd2;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.item-row .btn-remove-item:hover {
    background: #ffcdd2;
    border-color: #ef9a9a;
}

/* 일일/상시 토글 버튼 */
.item-row .product-type-toggle {
    display: flex;
    gap: 4px;
}

.item-row .btn-type-toggle {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.item-row .btn-type-toggle:hover {
    background: #f0f0f0;
}

.item-row .btn-type-toggle.active {
    background: #3C1E1E;
    color: #FEE500;
    border-color: #3C1E1E;
}

.item-row .btn-type-toggle.active[data-type="daily"] {
    background: #e67e22;
    border-color: #d35400;
}

.item-row .btn-type-toggle.active[data-type="regular"] {
    background: #3498db;
    border-color: #2980b9;
}

/* 저장 버튼 */
.item-row .btn-save-item {
    width: 32px;
    height: 32px;
    border: none;
    background: #28a745;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-row .btn-save-item:hover {
    background: #218838;
}

.item-row .btn-save-item:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.item-row .btn-save-item.saved {
    background: #17a2b8;
}

/* 단위 표시 */
.item-row .item-unit {
    font-size: 0.85rem;
    color: #666;
    min-width: 30px;
}

/* 직접 입력 모드 - 기존 third-line(단가) 제거하고 새 스타일 */
.item-row.custom-mode .first-line {
    display: flex;
    gap: 10px;
    align-items: center;
}

.item-row.custom-mode .second-line {
    display: flex;
    gap: 8px;
    align-items: center;
}

.item-row.saved {
    background: #d4edda;
}

/* Card */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    font-size: 1.1rem;
    color: #333;
}

.card-body {
    padding: 20px;
}

.card-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* Badge */
.badge {
    background: #FEE500;
    color: #3C1E1E;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-time {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: 4px;
}

.status-admin {
    background: #FEE500;
    color: #3C1E1E;
}

.status-user {
    background: #e3f2fd;
    color: #1565c0;
}

.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-inactive {
    background: #ffebee;
    color: #c62828;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.data-table th {
    background: linear-gradient(135deg, #3C1E1E, #5a2d2d);
    font-weight: 600;
    color: #FEE500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th:first-child {
    border-radius: 8px 0 0 0;
}

.data-table th:last-child {
    border-radius: 0 8px 0 0;
}

.data-table tbody tr {
    transition: all 0.2s;
}

.data-table tbody tr:hover {
    background: #fffdf0;
}

.data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.data-table tbody tr:nth-child(even):hover {
    background: #fffdf0;
}

.data-table th.actions,
.data-table td.actions {
    width: 165px;
    min-width: 165px;
    text-align: center;
}

.data-table td.actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

/* List Container */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #FEE500;
}

.list-item .item-name {
    font-weight: 500;
}

.list-item .item-actions {
    display: flex;
    gap: 8px;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.settings-actions {
    text-align: center;
    padding: 20px;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-row .form-group.half {
    flex: 1;
}

.required {
    color: #dc3545;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #888;
}

/* Button Large */
.btn-lg {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* Modal Small */
.modal-sm {
    max-width: 400px;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 10px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-menu li a {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .page-header,
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-box {
        margin-left: 0;
        justify-content: center;
    }

    .order-header {
        flex-direction: column;
        gap: 10px;
    }

    .order-actions {
        justify-content: stretch;
    }

    .order-actions .btn {
        flex: 1;
    }

    .item-row {
        flex-wrap: wrap;
    }

    .item-row .item-name-input {
        flex: 1 1 100%;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }
}

/* Modal Large */
.modal-lg {
    max-width: 700px;
}

/* Customer Info */
.customer-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.customer-info h4 {
    margin: 0 0 10px 0;
    color: #3C1E1E;
    font-size: 1.2rem;
}

.customer-stats {
    display: flex;
    gap: 20px;
}

.customer-stats .stat-item {
    color: #666;
    font-size: 0.9rem;
}

.customer-stats .stat-item strong {
    color: #3C1E1E;
}

/* Order History */
.order-history h5 {
    margin: 0 0 15px 0;
    color: #3C1E1E;
    font-size: 1rem;
}

/* Search Input */
.search-input {
    padding: 10px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.95rem;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #FEE500;
}

/* 검색 지우기 버튼 */
.btn-clear-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-search:hover {
    background: #c82333;
}

/* Table Container */
.table-container {
    padding: 0 !important;
    overflow-x: auto;
}

/* Sortable Headers */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: linear-gradient(135deg, #4a2828, #6a3838) !important;
}

.sortable .sort-icon {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.sortable.sorted .sort-icon {
    opacity: 1;
    color: #FEE500;
}

/* Pagination Container */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination .btn {
    min-width: 36px;
    padding: 6px 10px;
}

.page-numbers {
    display: flex;
    gap: 3px;
}

.page-numbers .btn {
    min-width: 36px;
}

.per-page-select select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Filter Bar Compact */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-bar .filter-group label {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.filter-bar input[type="date"],
.filter-bar select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
}

.filter-bar .search-input {
    padding: 6px 12px;
    min-width: 180px;
}

.filter-bar .btn {
    padding: 6px 16px;
}

/* Stats Box */
.stats-box {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.stats-box .stat-item {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.stats-box .stat-item.pending {
    background: #fff3cd;
    color: #856404;
}

.stats-box .stat-item.confirmed {
    background: #d4edda;
    color: #155724;
}

.stats-box .stat-item.cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Status Badges - Order */
.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-confirmed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Order Items Cell */
.order-items {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Detail Row */
.detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    flex: 0 0 100px;
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.detail-value {
    flex: 1;
    color: #333;
}

.raw-message {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.item-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 2px;
}

/* Responsive Pagination */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination {
        justify-content: center;
    }

    .pagination-info,
    .per-page-select {
        text-align: center;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .filter-group {
        width: 100%;
    }

    .stats-box {
        margin-left: 0;
        justify-content: center;
    }
}

/* SweetAlert2 카카오 테마 */
.swal2-popup {
    border-radius: 12px !important;
    padding: 24px !important;
}

.swal2-title {
    color: #3C1E1E !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
}

.swal2-html-container {
    margin-top: 16px !important;
}

.swal2-input {
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 12px 14px !important;
    font-size: 1rem !important;
    transition: border-color 0.2s !important;
}

.swal2-input:focus {
    border-color: #FEE500 !important;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.2) !important;
    outline: none !important;
}

.swal2-input::placeholder {
    color: #aaa !important;
}

.swal2-confirm {
    background: #3C1E1E !important;
    color: #FEE500 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

.swal2-confirm:hover {
    background: #5a2d2d !important;
}

.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(60, 30, 30, 0.3) !important;
}

.swal2-cancel {
    background: #e0e0e0 !important;
    color: #333 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 28px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

.swal2-cancel:hover {
    background: #d0d0d0 !important;
}

.swal2-cancel:focus {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

.swal2-validation-message {
    background: #f8d7da !important;
    color: #721c24 !important;
    border-radius: 6px !important;
    padding: 10px !important;
    margin-top: 10px !important;
}

.swal2-actions {
    margin-top: 20px !important;
    gap: 10px !important;
}

/* 품목 추가/수정 모달 공통 스타일 */
.upload-edit-modal {
    text-align: left;
}

.upload-edit-modal .edit-section {
    margin-bottom: 20px;
}

.upload-edit-modal .edit-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #3C1E1E;
    margin-bottom: 8px;
}

.upload-edit-modal .edit-item-input,
.upload-edit-modal .edit-item-qty-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s;
    box-sizing: border-box;
}

.upload-edit-modal .edit-item-qty-input {
    text-align: center;
    font-weight: 600;
}

.upload-edit-modal .edit-item-input:focus,
.upload-edit-modal .edit-item-qty-input:focus {
    border-color: #FEE500;
    outline: none;
    box-shadow: 0 0 0 3px rgba(254, 229, 0, 0.15);
}

.upload-edit-modal .edit-item-input::placeholder,
.upload-edit-modal .edit-item-qty-input::placeholder {
    color: #aaa;
}

/* 수정 모달 원본 메시지 라인 스타일 */
.upload-edit-modal .edit-raw-text {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.edit-raw-line {
    padding: 4px 0;
    color: #888;
    border-bottom: 1px dashed #ddd;
}

.edit-raw-line:last-child {
    border-bottom: none;
}

.edit-raw-line.last {
    font-weight: 700;
    color: #3C1E1E;
    background: rgba(254, 229, 0, 0.3);
    padding: 6px 8px;
    margin: 4px -10px -10px -10px;
    border-radius: 0 0 6px 6px;
}

/* ========================================
   품목 편집 공통 스타일 (ItemEditor 모듈용)
   pickup, order_history 등에서 사용
   ======================================== */

/* 품목 편집 컨테이너 */
.edit-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

/* 일반 모드 - flexbox 레이아웃 */
.edit-item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    transition: background-color 0.3s;
}

.edit-item-row .select2-container {
    flex: 1;
    min-width: 150px;
}

.edit-item-row .item-qty-input {
    width: 80px !important;
    flex-shrink: 0;
    padding: 8px 10px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 600;
}

.edit-item-row .item-qty-input:focus {
    border-color: #FEE500;
    outline: none;
    box-shadow: 0 0 0 2px rgba(254, 229, 0, 0.15);
}

.edit-item-row .item-unit {
    width: 40px;
    flex-shrink: 0;
    font-weight: 600;
    color: #3C1E1E;
    text-align: center;
    font-size: 0.85rem;
}

.edit-item-row .btn-remove-item {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: #ffebee;
    color: #c62828;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-item-row .btn-remove-item:hover {
    background: #ffcdd2;
    color: #b71c1c;
}

.edit-item-row.saving {
    background: #fff3cd;
}

.edit-item-row.saved {
    background: #d4edda;
}

/* 품목 추가 버튼 */
.btn-add-item-row {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ccc;
    background: transparent;
    color: #666;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-item-row:hover {
    border-color: #FEE500;
    background: #fffef5;
    color: #3C1E1E;
}

/* 저장 버튼 */
.edit-item-row .btn-save-item {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: #28a745;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-item-row .btn-save-item:hover {
    background: #218838;
}

.edit-item-row .btn-save-item:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.edit-item-row .btn-save-item.saved {
    background: #17a2b8;
}

/* 직접 입력 모드 */
.edit-item-row.custom-mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff8f5;
    border-color: #f0c0a0;
}

.edit-item-row.custom-mode .custom-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.edit-item-row.custom-mode .custom-input-row:first-child .select2-container {
    flex: 1;
    min-width: 150px;
}

.edit-item-row.custom-mode .custom-input-row:last-child .item-name-input {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    font-size: 0.9rem;
}

.edit-item-row.custom-mode .custom-input-row:last-child .item-name-input:focus {
    border-color: #FEE500;
    outline: none;
    box-shadow: 0 0 0 2px rgba(254, 229, 0, 0.15);
}

.edit-item-row.custom-mode .custom-input-row:last-child .item-qty-input {
    width: 80px !important;
}

.edit-item-row.custom-mode.saving {
    background: #fff3cd;
}

.edit-item-row.custom-mode.saved {
    background: #d4edda;
}

/* 일일/상시 토글 버튼 */
.edit-item-row .product-type-toggle {
    display: flex;
    gap: 4px;
}

.edit-item-row .btn-type-toggle {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.edit-item-row .btn-type-toggle:hover {
    background: #f0f0f0;
}

.edit-item-row .btn-type-toggle.active {
    background: #3C1E1E;
    color: #FEE500;
    border-color: #3C1E1E;
}

.edit-item-row .btn-type-toggle.active[data-type="daily"] {
    background: #e67e22;
    border-color: #d35400;
    color: white;
}

.edit-item-row .btn-type-toggle.active[data-type="regular"] {
    background: #3498db;
    border-color: #2980b9;
    color: white;
}

/* ==================== 품목별 수량 요약 스타일 (한 줄 형식) ==================== */
.items-summary-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 15px;
    overflow: hidden;
}

.items-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #3C1E1E, #5a2d2d);
    color: #FEE500;
    cursor: pointer;
    user-select: none;
}

.items-summary-header:hover {
    background: linear-gradient(135deg, #4a2626, #6a3535);
}

.summary-toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.summary-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.summary-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.summary-example {
    font-size: 0.7rem;
    color: rgba(254, 229, 0, 0.6);
    font-weight: 400;
    flex: 1;
}

.summary-badge {
    background: rgba(254, 229, 0, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.items-summary-content {
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.items-summary-content.collapsed {
    max-height: 0 !important;
}

.items-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    align-items: center;
}

.summary-item-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.summary-item-chip.has-remaining {
    background: #fff8e1;
    border-color: #ffc107;
}

.summary-item-chip.all-completed {
    background: #e8f5e9;
    border-color: #28a745;
    opacity: 0.7;
}

.summary-item-chip .chip-name {
    font-weight: 600;
    color: #3C1E1E;
}

.summary-item-chip .chip-stats {
    display: flex;
    gap: 4px;
    font-size: 0.75rem;
}

.summary-item-chip .chip-ordered {
    color: #666;
}

.summary-item-chip .chip-completed {
    color: #28a745;
}

.summary-item-chip .chip-remaining {
    color: #dc3545;
    font-weight: 700;
}

.summary-item-chip .chip-remaining.zero {
    color: #28a745;
}

/* 클릭 가능한 칩 스타일 */
.summary-item-chip {
    cursor: pointer;
    transition: all 0.2s ease;
}

.summary-item-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 선택된 칩 스타일 */
.summary-item-chip.selected {
    background: linear-gradient(135deg, #FEE500, #ffd700) !important;
    border-color: #3C1E1E !important;
    box-shadow: 0 2px 8px rgba(254, 229, 0, 0.5);
    opacity: 1 !important;
}

.summary-item-chip.selected .chip-name {
    color: #3C1E1E;
}

.summary-item-chip.selected .chip-stats {
    color: #5a2d2d;
}

.summary-item-chip.selected .chip-ordered,
.summary-item-chip.selected .chip-completed,
.summary-item-chip.selected .chip-remaining {
    color: #5a2d2d;
}

.summary-loading,
.summary-empty {
    padding: 15px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* 수량 경고 스타일 */
.order-qty-warnings {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
}

.qty-warning-item {
    font-size: 0.8rem;
    color: #856404;
    padding: 2px 0;
}

.order-item.has-qty-warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.item-warning-icon {
    margin-left: 4px;
    font-size: 0.85rem;
}

/* 검색 그룹 스타일 */
.search-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-clear-search {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-search:hover {
    color: #dc3545;
}

/* ==================== 필터 영역 요소 높이 통일 (42px 기준) ==================== */
/* datepicker, 검색 input, 버튼, select 모두 동일한 높이 */

input[type="date"],
.filter-bar input[type="text"],
.filter-bar select,
.filter-bar .search-input,
.filter-bar .btn,
.compact-header input[type="text"],
.compact-header select,
.compact-header .search-input,
.compact-header .btn,
.card-header-actions .search-input,
.card-header-actions .btn,
.date-controls .btn {
    min-height: 42px;
    height: 42px;
    font-size: 0.95rem;
    padding: 8px 14px;
    box-sizing: border-box;
    vertical-align: middle;
}

/* datepicker 기본 스타일 */
input[type="date"] {
    cursor: pointer;
    min-width: 150px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    width: 24px;
    height: 24px;
    cursor: pointer;
    padding: 4px;
}

/* 검색 input 스타일 */
.filter-bar .search-input,
.compact-header .search-input,
.card-header-actions .search-input {
    min-width: 180px;
}

/* 버튼 스타일 조정 */
.filter-bar .btn,
.compact-header .btn,
.card-header-actions .btn,
.date-controls .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 검색 지우기 버튼 예외 (작은 원형 버튼) */
.btn-clear-search {
    min-height: auto;
    height: 28px;
    width: 28px;
    padding: 0;
}

/* 터치 디바이스에서 더 큰 사이즈 */
@media (pointer: coarse) {
    input[type="date"],
    .filter-bar input[type="text"],
    .filter-bar select,
    .filter-bar .search-input,
    .filter-bar .btn,
    .compact-header input[type="text"],
    .compact-header select,
    .compact-header .search-input,
    .compact-header .btn,
    .card-header-actions .search-input,
    .card-header-actions .btn,
    .date-controls .btn {
        min-height: 48px;
        height: 48px;
        font-size: 1rem;
        padding: 10px 16px;
    }

    input[type="date"]::-webkit-calendar-picker-indicator {
        width: 28px;
        height: 28px;
    }

    .btn-clear-search {
        min-height: auto;
        height: 32px;
        width: 32px;
    }
}

/* ==================== 성능 최적화 ==================== */

/* transition: all 대신 구체적인 속성 지정 (GPU 가속 및 리플로우 최소화) */
.nav-menu li a {
    transition: background-color 0.2s, border-color 0.2s;
}

.btn {
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-status-filter {
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.order-card {
    transition: box-shadow 0.2s;
}

.modal-close {
    transition: background-color 0.2s, color 0.2s;
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.item-row .item-select,
.item-row .item-name-input,
.item-row .item-qty-input {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.item-row .btn-remove-item,
.item-row .btn-type-toggle,
.item-row .btn-save-item {
    transition: background-color 0.2s, border-color 0.2s;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.btn-clear-search {
    transition: color 0.2s;
}

.edit-item-row {
    transition: background-color 0.2s;
}

.edit-item-row .btn-remove-item,
.edit-item-row .btn-save-item,
.edit-item-row .btn-type-toggle {
    transition: background-color 0.2s;
}

.btn-add-item-row {
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.items-summary-header {
    transition: background 0.2s;
}

.summary-item-chip {
    transition: transform 0.2s, box-shadow 0.2s;
}

/* GPU 가속 힌트 - 자주 변경되는 요소 */
.modal,
.swal2-container {
    will-change: opacity;
}

.order-card:hover,
.btn:hover,
.summary-item-chip:hover {
    will-change: transform;
}

/* 스크롤 성능 최적화 */
.order-list,
.data-table tbody,
.items-summary-grid {
    contain: layout style;
}

/* 불필요한 리페인트 방지 */
.order-card,
.pending-card,
.edit-item-row {
    contain: layout;
}

/* ==================== Flatpickr 달력 스타일 (모던) ==================== */
.flatpickr-calendar {
    width: 350px !important;
    font-size: 14px !important;
    box-shadow: 0 12px 36px rgba(0,0,0,0.15) !important;
    border-radius: 16px !important;
    border: none !important;
    padding: 16px !important;
    background: #fff !important;
}

/* 화살표 완전 제거 */
.flatpickr-calendar:before,
.flatpickr-calendar:after,
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
    display: none !important;
    border: none !important;
}

.flatpickr-innerContainer {
    width: 100% !important;
}

.flatpickr-months {
    padding: 0 0 16px 0 !important;
    align-items: center !important;
    position: relative !important;
}

.flatpickr-months .flatpickr-month {
    height: 36px !important;
}

.flatpickr-current-month {
    font-size: 135% !important;
    line-height: inherit !important;
    font-weight: 300 !important;
    color: inherit !important;
    position: absolute !important;
    width: 75% !important;
    left: 12.5% !important;
    padding: 1px 0 0 0 !important;
    line-height: 1 !important;
    height: 30px !important;
    margin: 0 !important;
    display: inline-block !important;
    text-align: center !important;
    transform: translate3d(0, 0, 0) !important;
}

/* 월/년 드롭다운 스타일 */
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month .numInputWrapper input {
    font-weight: 600 !important;
    font-size: 14px !important;
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    height: 30px !important;
    cursor: pointer !important;
    color: #333 !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    margin-right: 8px !important;
}

.flatpickr-current-month .numInputWrapper {
    display: inline-block !important;
}

.flatpickr-current-month .numInputWrapper input {
    width: 70px !important;
    text-align: center !important;
}

.flatpickr-current-month .numInputWrapper span {
    display: none !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month .numInputWrapper input:hover {
    background: #e8e8e8 !important;
    border-color: #ccc !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:focus,
.flatpickr-current-month .numInputWrapper input:focus {
    outline: none !important;
    border-color: #FEE500 !important;
    box-shadow: 0 0 0 2px rgba(254, 229, 0, 0.2) !important;
}

/* 좌우 이동 버튼 - 모던 스타일 */
.flatpickr-prev-month,
.flatpickr-next-month {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    transition: all 0.15s ease !important;
    position: absolute !important;
    top: 30% !important;
    transform: translateY(-50%) !important;
}

.flatpickr-prev-month {
    left: 0 !important;
}

.flatpickr-next-month {
    right: 0 !important;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    background: #3C1E1E !important;
    border-color: #3C1E1E !important;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
    width: 10px !important;
    height: 10px !important;
    fill: #666 !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: #FEE500 !important;
}

/* 요일 헤더 */
.flatpickr-weekdays {
    height: 36px !important;
    background: transparent !important;
    border-bottom: 1px solid #eee !important;
    margin-bottom: 8px !important;
}

.flatpickr-weekday {
    font-size: 12px !important;
    color: #999 !important;
    font-weight: 600 !important;
}

.flatpickr-days {
    width: 100% !important;
}

.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

/* 날짜 셀 */
.flatpickr-day {
    flex-basis: 14.2857% !important;
    max-width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    margin: 1px !important;
    font-weight: 500 !important;
    color: #333 !important;
    border: none !important;
    position: relative !important;
}

.flatpickr-day.today {
    background: #f0f0f0 !important;
    font-weight: 700 !important;
    color: #3C1E1E !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #3C1E1E !important;
    color: #FEE500 !important;
    font-weight: 700 !important;
}

.flatpickr-day:hover {
    background: #FEE500 !important;
    color: #3C1E1E !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #ccc !important;
}

.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
    background: #f5f5f5 !important;
    color: #999 !important;
}

/* 달력 날짜별 품목 개수 배지 */
.flatpickr-day .day-count-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    background: #3C1E1E;
    color: #FEE500;
    padding: 2px 9px;
    border-radius: 6px;
    font-weight: 700;
    line-height: 1.2;
    min-width: 14px;
    text-align: center;
    z-index: 1;
}

.flatpickr-day.has-products {
    padding-bottom: 10px !important;
    line-height: 32px !important;
}

.flatpickr-day.has-products:not(.selected):not(.today) {
    background: #fffde7 !important;
}

/* Flatpickr 입력 필드 - 달력 아이콘 */
input.flatpickr-input,
input.date-picker,
input[data-input] {
    padding-right: 36px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 16px !important;
    cursor: pointer;
}

input.flatpickr-input:focus,
input.date-picker:focus,
input[data-input]:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%233C1E1E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
}

/* ============================================
   RESPONSIVE - Tablet (max-width: 992px)
   ============================================ */
@media (max-width: 992px) {
    .container {
        padding: 15px;
    }

    /* Navigation - Tablet */
    .navbar {
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    .nav-brand a {
        font-size: 1rem;
    }

    .nav-menu {
        gap: 0;
    }

    .nav-menu li a {
        padding: 8px 8px;
        font-size: 0.8rem;
    }

    /* Tables - Tablet */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    /* Cards - Tablet */
    .card {
        margin-bottom: 15px;
    }

    .card-body {
        padding: 15px;
    }

    /* Forms - Tablet */
    .form-group {
        margin-bottom: 12px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    /* Grid layouts - Tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ============================================
   RESPONSIVE - Mobile (max-width: 576px)
   ============================================ */
@media (max-width: 576px) {
    .container {
        padding: 10px;
    }

    /* Navigation - Mobile Hamburger */
    .navbar {
        flex-direction: column;
        padding: 8px;
        position: relative;
    }

    .nav-brand {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-brand a {
        font-size: 0.95rem;
    }

    .nav-menu {
        width: 100%;
        flex-direction: column;
        display: none;
        margin-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 8px;
    }

    .navbar.menu-open .nav-menu {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu li a {
        padding: 10px;
        font-size: 0.9rem;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .nav-menu li a.active {
        border-left-color: #FEE500;
        border-bottom: none;
    }

    .nav-toggle {
        display: block;
        background: none;
        border: none;
        color: #fff;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 5px;
    }

    /* Dropdown - Mobile */
    .nav-dropdown .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        background: rgba(255,255,255,0.05);
    }

    .nav-dropdown .dropdown-menu li a {
        padding-left: 20px;
    }

    /* Nav User - Mobile */
    .nav-user {
        display: none;
        width: 100%;
        justify-content: space-between;
        padding: 10px 0;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 8px;
    }

    .navbar.menu-open .nav-user {
        display: flex;
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .btn-logout {
        padding: 8px 16px;
    }

    /* Page Header - Mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .page-desc {
        font-size: 0.85rem;
    }

    /* Tables - Mobile */
    .table-container {
        margin: 0 -10px;
        border-radius: 0;
    }

    table {
        min-width: 100%;
        font-size: 0.8rem;
    }

    th, td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Cards - Mobile */
    .card {
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .card-header {
        padding: 12px;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 12px;
    }

    /* Forms - Mobile */
    .form-group {
        margin-bottom: 10px;
    }

    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        width: 100%;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
        width: auto;
    }

    /* Button groups - Mobile */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-group .btn {
        flex: 1 1 auto;
    }

    /* Stats Grid - Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Filter/Search sections - Mobile */
    .filter-section,
    .search-section {
        flex-direction: column;
        gap: 8px;
    }

    .filter-section .form-control,
    .search-section .form-control {
        width: 100%;
    }

    /* Date range - Mobile */
    .date-range {
        flex-direction: column;
        gap: 8px;
    }

    .date-range .form-control {
        width: 100%;
    }

    /* Modal - Mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .modal-header {
        padding: 12px 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 12px 15px;
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Pagination - Mobile */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .pagination .btn {
        padding: 8px 12px;
        min-width: 40px;
    }

    /* Select2 - Mobile */
    .select2-container {
        width: 100% !important;
    }

    /* Utility classes for responsive */
    .d-none-mobile {
        display: none !important;
    }

    .d-block-mobile {
        display: block !important;
    }

    .text-center-mobile {
        text-align: center !important;
    }

    .mb-mobile {
        margin-bottom: 10px !important;
    }
}

/* ============================================
   RESPONSIVE - Small Mobile (max-width: 375px)
   ============================================ */
@media (max-width: 375px) {
    .nav-brand a {
        font-size: 0.85rem;
    }

    .page-header h1 {
        font-size: 1.1rem;
    }

    th, td {
        padding: 6px 4px;
        font-size: 0.75rem;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets */
    .btn {
        min-height: 44px;
    }

    .nav-menu li a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects for touch */
    .btn:hover {
        transform: none;
    }

    /* Better touch scrolling */
    .table-container {
        -webkit-overflow-scrolling: touch;
    }
}
