/* KFC管理系统 - 公共样式 */

:root {
    --kfc-primary: #4a6cf7;
    --kfc-primary-dark: #3a5bd9;
}

body {
    background-color: #f5f5f5;
}

/* ========== 侧边栏样式 ========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background: linear-gradient(180deg, #4a6cf7 0%, #3a5bd9 100%);
    padding-top: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 侧边栏滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h4 {
    color: white;
    margin: 0;
    font-weight: bold;
}

.sidebar-header small {
    color: rgba(255,255,255,0.7);
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: white;
}

.sidebar .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: white;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
}

.nav-section-title {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    padding: 15px 20px 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== 主内容区样式 ========== */
.main-content {
    margin-left: 250px;
    padding: 0;
    min-height: 100vh;
}

.top-navbar {
    background: white;
    padding: 15px 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
}

.content-area {
    padding: 25px;
}

/* ========== 卡片样式 ========== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
}

/* ========== 系统开关样式 ========== */
.system-switch-card {
    border: 1px solid #ffe1e1;
    box-shadow: 0 8px 24px rgba(255, 0, 0, 0.08);
}

.system-switch-header {
    background: linear-gradient(90deg, #fff5f5 0%, #ffffff 100%);
    border-bottom: 1px dashed #ffd2d2;
}

.system-switch-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #ffefef;
    color: #e4002b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 12px;
}

.system-switch-title {
    font-size: 18px;
    font-weight: 700;
    color: #c40024;
}

.system-switch-subtitle {
    font-size: 12px;
    color: #a65b5b;
}

.system-switch-item {
    border: 1px solid #ffe3e3;
    background: #fffafa;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.system-switch-label {
    font-weight: 600;
    color: #333;
}

.system-switch-desc {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.system-switch-toggle .form-check-input {
    width: 3.2rem;
    height: 1.6rem;
    cursor: pointer;
}

.system-switch-toggle .form-check-label {
    margin-left: 10px;
    font-weight: 600;
    color: #555;
}

/* ========== 统计卡片样式 ========== */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-align: center;
}

.stats-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stats-card .value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.stats-card .label {
    color: #666;
    font-size: 14px;
}

/* ========== 按钮样式 ========== */
.btn-kfc {
    background: var(--kfc-primary);
    border: none;
    color: white;
}

.btn-kfc:hover {
    background: var(--kfc-primary-dark);
    color: white;
}

.btn-outline-kfc {
    border: 1px solid var(--kfc-primary);
    color: var(--kfc-primary);
}

.btn-outline-kfc:hover {
    background: var(--kfc-primary);
    color: white;
}

/* ========== 表格样式 ========== */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #666;
    background: #f8f9fa;
}

.table th:first-child {
    padding-left: 20px;
}

.table td:first-child {
    padding-left: 20px;
}

.table th:last-child {
    padding-right: 20px;
}

.table td:last-child {
    padding-right: 20px;
}

/* 表格不换行样式 */
.table-nowrap th,
.table-nowrap td {
    white-space: nowrap;
}

/* ========== 分页样式 ========== */
.pagination {
    margin-bottom: 0;
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========== 搜索框 ========== */
.search-box {
    max-width: 300px;
}

/* ========== 表单样式 ========== */
.collect-form .form-label {
    font-weight: 500;
}

.result-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* ========== 餐品管理专用样式 ========== */
.badge-menu-type {
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: 500;
    font-size: 12px;
}

.badge-classic {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-prime {
    background: #fff3e0;
    color: #ef6c00;
}

.spec-preview {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #666;
}

.price-text {
    font-weight: bold;
    color: #e53935;
}

/* ========== 采集指定餐品规格 - 搜索下拉 ========== */
.spec-search-wrapper {
    position: relative;
}

.spec-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1060;
    display: none;
}

.spec-search-dropdown.show {
    display: block;
}

.spec-search-item {
    border: none;
    border-bottom: 1px solid #f1f3f5;
    padding: 10px 12px;
}

.spec-search-item:last-child {
    border-bottom: none;
}

.spec-search-name {
    font-weight: 600;
    color: #333;
}

/* ========== 库存管理专用样式 ========== */
.stock-count {
    font-size: 18px;
    font-weight: bold;
    color: #4caf50;
}

.expire-soon {
    color: #ff9800;
}

.expire-warning {
    color: #f44336;
}

.progress-task {
    margin-top: 10px;
}

.refresh-status {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.coupon-name {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== 规格选择器样式 ========== */
.spec-viewer {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.spec-round {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.spec-round-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spec-round-title .badge {
    font-size: 10px;
}

.spec-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    margin: 4px;
    background: #e3f2fd;
    border-radius: 20px;
    font-size: 13px;
}

.spec-item.condiment {
    background: #fff3e0;
}

.spec-item.group-item {
    background: #e8f5e9;
}

.spec-item-name {
    margin-right: 6px;
}

.spec-item-price {
    color: #e53935;
    font-weight: 500;
}

.spec-item-quantity {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 6px;
}

.group-round {
    border-left: 3px solid #4caf50;
}

.condiment-round {
    border-left: 3px solid #ff9800;
}

.normal-round {
    border-left: 3px solid #2196f3;
}

.spec-empty {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* ========== 页面容器（SPA用）========== */
.page-container {
    display: none;
}

.page-container.active {
    display: block;
}

/* ========== 嵌套模态框样式 ========== */
/* 当主弹窗已打开时，二级弹窗增强显示效果 */
.modal.show ~ .modal .modal-content {
    border: 2px solid var(--kfc-primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* 二级弹窗遮罩层加深 */
.modal.show ~ .modal.show .modal-backdrop,
.modal.show ~ .modal .modal-dialog {
    z-index: 1060;
}

/* 二级弹窗的头部突出显示 */
.modal.show ~ .modal .modal-header {
    background: linear-gradient(135deg, var(--kfc-primary) 0%, var(--kfc-primary-dark) 100%);
    color: white;
    border-radius: 6px 6px 0 0;
}

.modal.show ~ .modal .modal-header .modal-title {
    color: white;
}

.modal.show ~ .modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ========== SKU对接列表 - 关联方案样式 ========== */
.sku-plans-cell {
    max-width: 280px;
}

.sku-plan-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 3px 0;
    border-bottom: 1px dashed #eee;
    white-space: nowrap;
}

.sku-plan-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.sku-plan-item .badge {
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}

.sku-plan-detail {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

/* 悬浮提示样式优化 */
.sku-plan-item[title] {
    cursor: help;
}

/* 未找到对应下单方案的高亮警告样式 */
.sku-plan-not-found {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 4px 8px !important;
    animation: pulse-warning 2s infinite;
}

.sku-plan-not-found .badge {
    font-size: 12px;
    padding: 4px 8px;
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
    }
}

/* 旋转动画（用于加载状态） */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}
