/**
 * 百望云企业发票管理系统 - 自定义样式
 * Modern 2026 Design Language
 */

/* ===== CSS Variables ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --sidebar-width: 240px;
    --navbar-height: 56px;
}

/* ===== 全局 ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f3f4f6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 顶部导航 ===== */
.bg-gradient-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
}

.navbar {
    min-height: var(--navbar-height);
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* ===== 侧边栏 ===== */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: var(--navbar-height);
    z-index: 1020;
    transition: all 0.3s ease;
}

.sidebar .sidebar-header {
    background: rgba(255, 255, 255, 0.05);
}

/* 收缩状态 */
.sidebar.collapsed {
    min-width: 64px !important;
    max-width: 64px !important;
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed #sidebarCollapseIcon {
    display: none;
}

.sidebar.collapsed .sidebar-link {
    padding: 10px 8px;
    text-align: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-link .sidebar-icon {
    margin-right: 0 !important;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.5rem 0.25rem !important;
}

.sidebar.collapsed #sidebarCollapseBtn {
    padding: 0.35rem;
    font-size: 0.85rem;
}

/* 展开时按钮图标 */
#sidebarCollapseIcon {
    transition: transform 0.3s ease;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.7) !important;
    border-radius: 8px;
    padding: 10px 14px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.sidebar-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    color: #fff !important;
    background: var(--primary) !important;
}

.sidebar-link .sidebar-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== 主内容区 ===== */
#page-content-wrapper {
    min-height: calc(100vh - var(--navbar-height));
    background-color: #f3f4f6;
}

/* ===== 卡片 ===== */
.card {
    border-radius: 12px;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* ===== 统计卡片 ===== */
.stats-card {
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-number {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.stats-label {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* ===== 表格 ===== */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    border-radius: 0 0 12px 12px;
}

/* ===== 按钮组 ===== */
.btn-group-sm .btn {
    border-radius: 6px !important;
    margin: 1px;
}

.btn-group .btn {
    margin: 0 2px;
}

/* ===== 表单 ===== */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.35rem;
}

/* ===== Toast 通知 ===== */
.toast-container {
    z-index: 9999;
}

.toast {
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ===== 模态框 ===== */
.modal-content {
    border-radius: 16px;
    border: none;
}

.modal-header {
    border-radius: 16px 16px 0 0;
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
}

/* ===== 徽章 ===== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ===== 面包屑 ===== */
.breadcrumb {
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ===== Pre / Code ===== */
pre {
    font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.875em;
}

/* ===== 分页 ===== */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 6px !important;
    margin: 0 2px;
    border: none;
    color: var(--primary);
}

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

/* ===== 加载动画 ===== */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ===== 响应式 - 平板 ===== */
@media (max-width: 991.98px) {
    .sidebar {
        display: none !important;
    }

    #page-content-wrapper {
        width: 100% !important;
    }
}

/* ===== 响应式 - 手机 ===== */
@media (max-width: 767.98px) {
    .container-fluid {
        padding: 0.75rem !important;
    }

    .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    .stats-number {
        font-size: 1.3rem;
    }

    .card-body {
        padding: 1rem !important;
    }

    .table th, .table td {
        font-size: 0.8rem;
        padding: 0.5rem 0.4rem;
    }

    /* 手机端隐藏次要列 */
    .mobile-hide {
        display: none;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    h5 {
        font-size: 1rem;
    }
}

/* ===== 响应式 - 超小屏 ===== */
@media (max-width: 375px) {
    .btn-group {
        display: flex;
        flex-wrap: wrap;
    }

    .btn-group .btn {
        flex: 1;
        min-width: 60px;
        font-size: 0.7rem;
        padding: 0.25rem 0.35rem;
    }
}

/* ===== 打印 ===== */
@media print {
    .navbar, .sidebar, .btn, #sidebar, .breadcrumb {
        display: none !important;
    }

    #page-content-wrapper {
        width: 100% !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ===== 工具类 ===== */
.cursor-pointer {
    cursor: pointer;
}

.word-break-all {
    word-break: break-all;
}
