/* ============================================================
   会所点餐系统 - 自定义样式
   主色调：深红/金色会所风格
   ============================================================ */

/* ---- CSS变量定义 ---- */
:root {
    --club-red: #8B0000;
    --club-red-light: #A52A2A;
    --club-red-dark: #5C0000;
    --club-gold: #D4A017;
    --club-gold-light: #F0D060;
    --club-bg: #1a1a2e;
    --club-card: #16213e;
    --club-text: #e0e0e0;
    --club-white: #ffffff;
    --tab-height: 60px;
}

/* ---- 全局基础样式 ---- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* ---- 顶部导航栏会所风格 ---- */
.navbar-dark.bg-dark {
    background: linear-gradient(135deg, var(--club-red-dark), var(--club-red)) !important;
    border-bottom: 2px solid var(--club-gold);
}

.navbar-brand {
    color: var(--club-gold-light) !important;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ---- 底部Tab导航栏 ---- */
.fixed-bottom.navbar {
    height: var(--tab-height);
    min-height: var(--tab-height);
    max-height: var(--tab-height);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    border-top: 2px solid var(--club-gold);
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.tab-link {
    color: #aaa !important;
    padding: 0.25rem 0.5rem !important;
    transition: color 0.2s;
    flex: 1;
    text-decoration: none;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.tab-link:hover,
.tab-link:focus {
    color: var(--club-gold-light) !important;
}

.tab-link.active {
    color: var(--club-gold) !important;
}

.tab-link.active .bi {
    text-shadow: 0 0 8px var(--club-gold);
}

/* ---- 页面底部留白（不被Tab栏遮挡） ---- */
.pb-5 {
    padding-bottom: calc(0.5rem + var(--tab-height)) !important;
}

main {
    padding-bottom: calc(var(--tab-height) + 4px);
}

/* ---- 房间卡片 ---- */
.room-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.room-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.room-card .card-header {
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.95rem;
}

.room-card .card-body {
    padding: 1rem;
    text-align: center;
}

.room-status-idle .card-header { background-color: #28a745; }
.room-status-in_use .card-header { background-color: #0d6efd; }
.room-status-pending_checkout .card-header { background-color: #dc3545; }

/* ---- 菜品卡片 ---- */
.dish-card {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

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

.dish-card .price {
    color: var(--club-red);
    font-weight: bold;
    font-size: 1.1rem;
}

.dish-card.out-of-stock {
    opacity: 0.5;
    position: relative;
}

/* ---- 订单项列表 ---- */
.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eee;
}

.order-item:last-child {
    border-bottom: none;
}

/* ---- 侧边分类导航 ---- */
.category-nav {
    width: 80px;
    min-width: 80px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

.category-nav .nav-item {
    padding: 0.6rem 0.3rem;
    text-align: center;
    font-size: 0.8rem;
    border-left: 3px solid transparent;
    cursor: pointer;
    color: #666;
}

.category-nav .nav-item.active {
    border-left-color: var(--club-red);
    color: var(--club-red);
    background: #fff;
    font-weight: 600;
}

.category-nav .nav-item:hover {
    background: #eee;
}

/* ---- 点餐页面布局 ---- */
.order-layout {
    display: flex;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.order-dishes {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.order-summary {
    width: 280px;
    min-width: 280px;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.order-summary .summary-header {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    background: var(--club-red);
    color: #fff;
}

.order-summary .summary-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.order-summary .summary-footer {
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* ---- 会所风格按钮 ---- */
.btn-club {
    background: linear-gradient(135deg, var(--club-red), var(--club-red-light));
    color: #fff;
    border: none;
    font-weight: 600;
}

.btn-club:hover {
    background: linear-gradient(135deg, var(--club-red-dark), var(--club-red));
    color: #fff;
}

.btn-gold {
    background: linear-gradient(135deg, var(--club-gold), var(--club-gold-light));
    color: #333;
    border: none;
    font-weight: 600;
}

.btn-gold:hover {
    color: #333;
    opacity: 0.9;
}

/* ---- 统计卡片 ---- */
.stat-card {
    border-radius: 12px;
    padding: 1.2rem;
    color: #fff;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: bold;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ---- 管理页面卡片 ---- */
.admin-menu-card {
    display: flex;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.2s;
    margin-bottom: 0.75rem;
}

.admin-menu-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    color: var(--club-red);
    text-decoration: none;
}

.admin-menu-card .admin-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    margin-right: 1rem;
    flex-shrink: 0;
}

.admin-menu-card .admin-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.admin-menu-card .admin-desc {
    font-size: 0.8rem;
    color: #888;
}

/* ---- 移动端适配 ---- */
@media (max-width: 768px) {
    .category-nav {
        width: 65px;
        min-width: 65px;
    }

    .category-nav .nav-item {
        font-size: 0.7rem;
        padding: 0.5rem 0.2rem;
    }

    .order-layout {
        height: calc(100vh - 140px);
    }

    .order-summary {
        position: fixed;
        /* 底部留出 tab 栏高度 + 移动端购物车浮层高度(~56px) + 间距，确保确认按钮不被遮挡 */
        bottom: calc(var(--tab-height) + 64px);
        left: 0;
        right: 0;
        width: 100% !important;
        min-width: 100% !important;
        /* 高度足以容纳 header + 菜品列表 + footer(确认按钮)，同时不超出可视区域 */
        max-height: calc(65vh - var(--tab-height));
        height: auto;
        border-left: none;
        border-top: 2px solid var(--club-gold);
        z-index: 100;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        display: none;
        /* 使用 flex 列布局，让 footer 固定在底部 */
        flex-direction: column;
    }

    .order-summary.show-mobile {
        display: flex !important;
    }

    /* 移动端弹层内，菜品列表区域自适应剩余高度，footer 不被挤出 */
    .order-summary .summary-body {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
    }

    /* 确认按钮区域固定在弹层底部，不参与 flex 伸缩 */
    .order-summary .summary-footer {
        flex-shrink: 0;
        /* 增加底部 padding，防止按钮被手机底部手势条或 Tab 栏遮挡 */
        padding-bottom: 1.5rem;
        /* 增加顶部间距，让合计和确认按钮明显分开 */
        padding-top: 1rem;
        border-top: 2px solid #e9ecef;
    }

    /* 移动端合计金额与确认按钮之间增加间距 */
    .order-summary .summary-footer .d-flex.justify-content-between {
        margin-bottom: 0.75rem !important;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #f0f0f0;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    /* 大按钮适配移动端 */
    .btn {
        min-height: 36px;
        font-size: 0.9rem;
    }

    /* 移动端表格操作列按钮适配 */
    .table td .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
        min-width: auto;
        min-height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    /* 确保操作列不换行 */
    .table td .d-flex {
        flex-wrap: nowrap !important;
    }
}

@media (max-width: 480px) {
    .room-card .card-header {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    .room-card .card-body {
        padding: 0.6rem;
    }

    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* ---- 表格样式优化 ---- */
.table th {
    background: var(--club-red);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* ---- 滚动条美化 ---- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ---- 加载中动画 ---- */
.loading-spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

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

/* ---- 结账页面样式 ---- */
.billing-total {
    background: linear-gradient(135deg, var(--club-red-dark), var(--club-red));
    color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.billing-total .total-amount {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--club-gold-light);
}

/* ---- 日志条目样式 ---- */
.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

/* ---- 打印隐藏 ---- */
@media print {
    .fixed-bottom,
    .sticky-top,
    .no-print {
        display: none !important;
    }
}
