/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 登录页面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #667eea;
    font-size: 28px;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #999;
    font-size: 12px;
}

/* 导航栏 */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand h2 {
    color: #667eea;
    font-size: 20px;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #333;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #f0f0f0;
    color: #667eea;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Badge样式 - 与编辑删除按钮一致 */
.badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: normal;
    line-height: 1;
    color: white;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-info {
    background-color: #17a2b8;
}

.badge-secondary {
    background-color: #6c757d;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    min-height: calc(100vh - 200px);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #51cf66;
    color: white;
}

.btn-success:hover {
    background: #40c057;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

.btn-danger:hover {
    background: #fa5252;
}

.btn-secondary {
    background: #868e96;
    color: white;
}

.btn-secondary:hover {
    background: #6c757d;
}

.btn-outline {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

/* 提示信息 */
.alerts {
    margin-bottom: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 10px;
    position: relative;
}

.alert-success {
    background: #d3f9d8;
    color: #2b8a3e;
    border-left: 4px solid #51cf66;
}

.alert-error {
    background: #ffe3e3;
    color: #c92a2a;
    border-left: 4px solid #ff6b6b;
}

.alert-warning {
    background: #fff3bf;
    color: #e67700;
    border-left: 4px solid #fab005;
}

.alert-info {
    background: #d0ebff;
    color: #1864ab;
    border-left: 4px solid #339af0;
}

.alert-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
}

.alert-close:hover {
    opacity: 1;
}

/* 仪表板 */
.dashboard h1 {
    margin-bottom: 30px;
    color: #333;
}

.period-info {
    margin-bottom: 20px;
}

.period-info h2 {
    color: #667eea;
    font-size: 24px;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #333;
}

.stat-income .stat-number {
    color: #51cf66;
}

.stat-expense .stat-number {
    color: #ff6b6b;
}

.stat-profit .stat-number {
    color: #667eea;
}

.stat-loss .stat-number {
    color: #ff6b6b;
}

.branch-stats {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.branch-stats h2 {
    margin-bottom: 20px;
    color: #333;
}

.quick-actions {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-actions h2 {
    margin-bottom: 20px;
    color: #333;
}

.quick-actions .btn {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    font-weight: 600;
    color: #495057;
}

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

.text-success {
    color: #51cf66;
}

.text-danger {
    color: #ff6b6b;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 页脚 */
.footer {
    background: white;
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 50px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* 卡片 */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 20px;
    color: #333;
}

/* 筛选器 */
.filters {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.filters form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    align-items: end;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .navbar-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .stats-summary,
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
    }
    
    .quick-actions .btn {
        display: block;
        width: 100%;
        margin-right: 0;
    }
}


/* 导航下拉菜单 */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

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

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    z-index: 1000;
    margin-top: 5px;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: all 0.3s;
}

.dropdown-content a:hover {
    background-color: #f0f0f0;
    color: #667eea;
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

/* 修复下拉菜单位置 */
.nav-dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 1000 !important;
    min-width: 160px;
    background-color: white;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
}

.dropdown-content a {
    display: block !important;
    padding: 8px 16px;
    text-decoration: none;
    color: #333;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}


/* 改进下拉菜单悬停体验 */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown .dropdown-content {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 1000 !important;
    min-width: 180px;
    background-color: white;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    border-radius: 4px;
    display: none;
    margin-top: 0 !important; /* 消除间隙 */
}

/* 改进悬停逻辑 - 增加悬停区域 */
.nav-dropdown:hover .dropdown-content,
.nav-dropdown .dropdown-content:hover {
    display: block !important;
}

/* 为父元素添加padding，扩大悬停区域 */
.nav-dropdown > .nav-link {
    padding: 10px 15px !important;
    position: relative;
}

/* 子菜单项样式 */
.dropdown-content a {
    display: block !important;
    padding: 10px 16px !important;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: #f8f9fa !important;
    color: #667eea !important;
}

}



/* ==========================================
   Bootstrap 兼容性修复
   ========================================== */

/* 确保row和col正常工作 */
.row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -15px !important;
    margin-left: -15px !important;
}

.row > * {
    padding-right: 15px !important;
    padding-left: 15px !important;
}

/* 修复右侧栏样式 */
.right-sidebar .card {
    margin-bottom: 1rem;
}

/* 确保签名板容器正常显示 */
canvas {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    max-width: 100%;
}


/* 缩小左栏表单字体 */
.col-md-7 label,
.col-md-7 input,
.col-md-7 select,
.col-md-7 textarea,
.col-md-7 .form-group {
    font-size: 13px !important;
}

.col-md-7 h6,
.col-md-7 .card-header {
    font-size: 14px !important;
}

.col-md-7 button {
    font-size: 13px !important;
    padding: 8px 16px !important;
}


/* 同行信息与礼品卡管理卡片内容字体缩小（标题除外） */
#referral-giftcard-section .card-body label {
    font-size: 0.85rem !important;
}

#referral-giftcard-section .card-body input,
#referral-giftcard-section .card-body select {
    font-size: 0.85rem !important;
}

#referral-giftcard-section .card-body .btn {
    font-size: 0.85rem !important;
}

#referral-giftcard-section .card-body h6 {
    font-size: 0.9rem !important;
}

#referral-giftcard-section .card-body small,
#referral-giftcard-section .card-body .alert {
    font-size: 0.8rem !important;
}
