/* === I'm包租公 全局样式 === */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --sidebar-width: 250px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --content-bg: #f1f5f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--content-bg);
}

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

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: none;
}

.login-card .card-body {
    padding: 40px 30px;
}

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

.login-logo .logo-icon {
    font-size: 48px;
    color: var(--primary);
}

.login-logo h3 {
    font-weight: 700;
    color: #1e293b;
    margin-top: 10px;
}

.login-logo p {
    color: #64748b;
    font-size: 14px;
}

/* === 布局 === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === 侧边栏 === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar .sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #334155;
}

.sidebar .sidebar-header h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
    font-size: 18px;
}

.sidebar .sidebar-header small {
    color: #64748b;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 12px 20px;
    border-radius: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

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

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar .sidebar-footer {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid #334155;
}

.sidebar .sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 13px;
}

.sidebar .sidebar-footer .user-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

/* === 主内容区 === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
}

/* === 顶栏 === */
.topbar {
    background: #fff;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.topbar h4 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
}

/* === 统计卡片 === */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}

.stat-card .stat-info h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

.stat-card .stat-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.bg-icon-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-icon-green  { background: linear-gradient(135deg, #10b981, #059669); }
.bg-icon-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-icon-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.bg-icon-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-icon-cyan   { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* === 数据卡片 === */
.data-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.data-card .card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card .card-header h5 {
    margin: 0;
    font-weight: 700;
    color: #1e293b;
    font-size: 16px;
}

.data-card .card-body {
    padding: 0;
}

/* === 表格 === */
.table {
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* === 扮横幅 === */
.impersonate-banner {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    animation: pulse-banner 2s infinite;
}

@keyframes pulse-banner {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.impersonate-banner .btn-exit {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 13px;
    padding: 4px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.impersonate-banner .btn-exit:hover {
    background: rgba(255,255,255,0.3);
}

/* === 移动端汉堡菜单 === */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: #475569;
    cursor: pointer;
    padding: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1029;
}

/* === 移动端响应式 === */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1040;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 10px;
    }

    .mobile-toggle {
        display: block;
    }

    .topbar {
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 12px;
    }

    .topbar h4 {
        font-size: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .stat-card .stat-info h3 {
        font-size: 20px;
    }

    .stat-card .stat-info p {
        font-size: 12px;
    }

    .data-card .card-header {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .data-card .card-header h5 {
        font-size: 15px;
    }

    /* === 移动端表格卡片化 === */
    .table-responsive {
        overflow: visible;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        margin: 8px 12px;
        padding: 12px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }

    .table tbody tr:hover {
        background: #fff;
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f1f5f9;
        font-size: 13px;
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 12px;
        margin-right: 12px;
        flex-shrink: 0;
        max-width: 40%;
    }

    .table tbody td:last-child::before {
        display: none;
    }

    .table tbody td:last-child {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
        margin-top: 4px;
    }

    /* 移动端操作按钮 */
    .table tbody td .btn-sm {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .page-link {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* === 移动端弹出框全屏化 === */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-dialog .modal-content {
        border-radius: 14px 14px 0 0;
        height: auto;
        max-height: 100%;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        animation: slideUp 0.3s ease-out;
    }

    .modal-dialog.modal-sm .modal-content {
        max-height: 50vh;
    }

    .modal-dialog .modal-body {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }

    .modal-backdrop.show {
        opacity: 0.5;
    }

    /* 弹出框内部表单优化 */
    .modal-dialog .row {
        margin: 0;
    }

    .modal-dialog .row > [class*="col-"] {
        padding: 0 4px;
    }

    .modal-dialog .form-label {
        font-size: 13px;
    }

    .modal-dialog .form-control,
    .modal-dialog .form-select {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .modal-dialog .modal-header {
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 1;
        padding: 14px 16px;
        border-radius: 14px 14px 0 0;
    }

    .modal-dialog .modal-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        z-index: 1;
        padding: 12px 16px;
    }

    /* 筛选栏优化 */
    .data-card .card-body > .row,
    .data-card .card-body > div > .row {
        margin: 0;
    }

    .data-card .card-body .form-select,
    .data-card .card-body .form-control {
        font-size: 16px; /* 防止iOS缩放 */
    }

    /* impersonate banner */
    .impersonate-banner {
        font-size: 12px;
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 480px) {
    .login-card .card-body {
        padding: 30px 20px;
    }
}

/* === 表单 === */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
}

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

.form-label {
    font-weight: 600;
    color: #475569;
    font-size: 14px;
    margin-bottom: 6px;
}

/* === 按钮 === */
.btn {
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 18px;
    transition: all 0.2s;
}

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

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

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

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

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 16px 24px;
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* === 提示框 === */
.alert {
    border-radius: 10px;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
}