/* 羽毛球穿线管理系统 - 自定义样式 */

:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
}

/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    color: #5a5c69;
}

/* 导航栏 */
.navbar {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    z-index: 1030;  /* 确保导航栏在正常内容之上 */
}

/* 移动端导航栏层级更高 */
@media (max-width: 768px) {
    .navbar {
        z-index: 1060;  /* 移动端导航栏最高，高于侧边栏和菜单按钮 */
    }
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 700;
    color: var(--primary-color);
}

/* 统计卡片 */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--secondary-color);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-weight: 700;
}

/* 按钮样式 */
.btn {
    border-radius: 0.35rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

/* 表格样式 */
.table {
    color: var(--dark-color);
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid #e3e6f0;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    color: var(--primary-color);
}

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

.table tbody tr:hover {
    background-color: #f8f9fc;
}

/* 表单样式 */
.form-control {
    border-radius: 0.35rem;
    border: 1px solid #d1d3e2;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* 徽章样式 */
.badge {
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 0.35rem;
}

/* 警告框样式 */
.alert {
    border: none;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

/* 搜索框样式 */
.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.search-box .form-control {
    padding-left: 2.5rem;
}

/* 客户卡片 */
.customer-card {
    cursor: pointer;
    transition: all 0.2s;
}

.customer-card:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
}

.customer-card.selected {
    background-color: #e7f1ff;
    border-color: var(--primary-color);
}

/* 记录卡片 */
.record-card {
    border-left: 3px solid var(--primary-color);
}

.record-card.settled {
    border-left-color: var(--success-color);
    opacity: 0.8;
}

/* 登录页面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 1rem;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-body {
    padding: 2rem;
}

/* 侧边栏 */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 10%, #224abe 100%);
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 0.35rem;
    margin: 0.25rem 0;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* 加载动画 */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* 工具提示 */
.tooltip {
    font-size: 0.875rem;
}

/* 分页样式 */
.pagination {
    margin-top: 1.5rem;
}

.page-link {
    color: var(--primary-color);
    border-radius: 0.35rem;
    margin: 0 0.25rem;
}

.page-link:hover {
    background-color: var(--light-color);
    border-color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 侧边栏在移动端全屏显示 */
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: calc(100vh - 56px);
        background-color: white;
        z-index: 1040;  /* 提高层级，在 Bootstrap modal backdrop (1050) 之下 */
        overflow-y: auto;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        transition: none !important; /* 移除动画，提升速度 */
        /* 关闭时完全隐藏，不占用空间和事件 */
        visibility: hidden;
        pointer-events: none;
    }
    
    .sidebar.show {
        display: block !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    .sidebar.collapsing {
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    /* 加速 Bootstrap collapse 动画 */
    .sidebar.collapsing {
        transition: none !important;
    }
    
    /* 菜单项点击效果 */
    .sidebar .nav-link {
        transition: background-color 0.15s ease;
    }
    
    .sidebar .nav-link:active {
        background-color: rgba(13, 110, 253, 0.1);
    }
    
    /* 表格优化 */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* 备注列优化 - 自动换行 */
    .table td {
        word-wrap: break-word;
        word-break: break-word;
        white-space: normal !important;
        max-width: 150px;
    }
    
    /* 备注列特殊处理 */
    .table td:has(small),
    .table td small {
        display: block;
        white-space: normal !important;
        word-wrap: break-word;
        word-break: break-word;
        max-width: 120px;
        line-height: 1.4;
    }
    
    /* 卡片在移动端的间距 */
    .card {
        margin-bottom: 1rem;
    }
    
    /* 按钮组在移动端垂直排列 */
    .btn-toolbar {
        flex-direction: column;
    }
    
    .btn-toolbar .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* 统计卡片在移动端堆叠 */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* 表单在移动端的优化 */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* 移动端菜单按钮样式 */
    .d-md-none .btn {
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    
    /* 优化移动端菜单按钮的触摸区域 */
    [data-bs-toggle="collapse"] {
        min-height: 44px;  /* iOS 推荐的最小触摸目标 */
        min-width: 44px;
        padding: 0.75rem 1.5rem;
        touch-action: manipulation;  /* 禁用双击缩放 */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* 移动端侧边栏菜单项优化 */
    .sidebar .nav-link {
        min-height: 48px;  /* 增加触摸区域 */
        padding: 1rem 1.5rem;
        display: flex;
        align-items: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        transition: background-color 0.15s ease-in-out;
    }
    
    .sidebar .nav-link:active {
        background-color: rgba(255, 255, 255, 0.1);
        transform: scale(0.98);
    }
    
    /* 移动端按钮的触摸反馈 */
    .btn:active {
        transform: scale(0.95);
    }
    
    /* 确保菜单按钮在最上层（但低于导航栏） */
    main > .d-md-none {
        position: sticky;
        top: 56px;  /* 紧贴在导航栏下方 */
        z-index: 1055;  /* 高于侧边栏(1040)，低于导航栏(1060) */
        background-color: #f8f9fc;  /* 与页面背景色一致 */
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0 !important;
    }
    
    /* 确保菜单按钮本身层级足够 */
    main > .d-md-none button {
        position: relative;
        z-index: 1055;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
