/* CRM系统样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f7fa;
}

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

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 移动端登录页优化 */
@media screen and (max-width: 768px) {
    .login-container {
        align-items: flex-start;
        padding-top: 100px;
        padding-bottom: 20px;
        min-height: 100vh;
        height: auto;
    }
    
    .login-box {
        padding: 30px 20px;
        margin: 0 auto;
    }
    
    .login-title h1 {
        font-size: 24px;
    }
    
    /* iOS输入框优化 - 防止自动放大 */
    .login-box input,
    .login-box .el-input__inner {
        font-size: 16px !important;  /* iOS小于16px会触发自动放大 */
        -webkit-text-size-adjust: 100%;
        touch-action: manipulation;
    }
}

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

.login-title h1 {
    font-size: 28px;
    color: #303133;
    margin-bottom: 10px;
}

.login-title p {
    color: #909399;
    font-size: 14px;
}

/* 布局 */
.app-container {
    min-height: 100vh;
}

.main-container {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* 侧边栏 */
.sidebar {
    width: 200px;
    background-color: #304156;
    transition: width 0.3s;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-menu {
    border-right: none;
}

.el-menu {
    background-color: #304156;
    border-right: none;
}

.el-menu-item,
.el-sub-menu__title {
    color: #bfcbd9;
}

.el-menu-item:hover,
.el-sub-menu__title:hover {
    background-color: #263445;
}

.el-menu-item.is-active {
    color: #409eff;
    background-color: #263445;
}

/* 头部 */
.header {
    height: 60px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.header-left {
    display: flex;
    align-items: center;
}

.collapse-btn {
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-info .el-avatar {
    margin-right: 8px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    color: #303133;
    margin-bottom: 5px;
}

.page-header p {
    color: #909399;
    font-size: 14px;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: #303133;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .el-input {
    width: 200px;
}

/* 表格 */
.data-table {
    margin-top: 20px;
}

/* 分页 */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* 表单 */
.form-container {
    max-width: 600px;
}

/* 状态标签 */
.status-tag {
    display: inline-flex;
    align-items: center;
}

.status-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-new::before {
    background-color: #909399;
}

.status-contacted::before {
    background-color: #409eff;
}

.status-qualified::before {
    background-color: #67c23a;
}

.status-lost::before {
    background-color: #f56c6c;
}

.status-converted::before {
    background-color: #e6a23c;
}

/* 统计卡片 */
.stat-card {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.stat-icon.blue {
    background-color: #ecf5ff;
    color: #409eff;
}

.stat-icon.green {
    background-color: #f0f9eb;
    color: #67c23a;
}

.stat-icon.orange {
    background-color: #fdf6ec;
    color: #e6a23c;
}

.stat-icon.red {
    background-color: #fef0f0;
    color: #f56c6c;
}

.stat-info h3 {
    font-size: 24px;
    color: #303133;
    margin-bottom: 5px;
}

.stat-info p {
    color: #909399;
    font-size: 14px;
}

/* 跟进记录 */
.followup-list {
    max-height: 400px;
    overflow-y: auto;
}

.followup-item {
    padding: 15px;
    border-bottom: 1px solid #ebeef5;
}

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

.followup-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.followup-type {
    font-weight: 500;
    color: #409eff;
}

.followup-time {
    color: #909399;
    font-size: 12px;
}

.followup-content {
    color: #606266;
    line-height: 1.6;
}

.followup-footer {
    margin-top: 8px;
    color: #909399;
    font-size: 12px;
}

/* 遮罩层 */
.mobile-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* 动画 */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
    transition: transform 0.3s ease;
}

.slide-enter-from,
.slide-leave-to {
    transform: translateX(-100%);
}

/* 订单明细 */
.order-items {
    margin-top: 20px;
}

.order-item-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.order-item-row .el-input {
    flex: 1;
}

.order-item-row .el-input-number {
    width: 120px;
}

/* 报销明细 */
.expense-items-section {
    background-color: #f5f7fa;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h4 {
    margin: 0;
    color: #303133;
    font-size: 16px;
}

.total-amount {
    text-align: right;
    font-size: 16px;
    color: #606266;
    padding: 10px 0;
}

.total-amount .amount {
    color: #f56c6c;
    font-size: 20px;
    font-weight: bold;
}

.expense-detail {
    padding: 10px;
}

/* 权限组样式 */
.permission-groups {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: #f5f7fa;
    border-radius: 4px;
}

.permission-group {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
}

.permission-group h4 {
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ebeef5;
    color: #303133;
    font-size: 14px;
}

.permission-group .el-checkbox {
    margin-right: 20px;
    margin-bottom: 10px;
}

/* ==================== 移动端优化样式 ==================== */

/* 桌面端表格默认显示 */
.desktop-table {
    display: block;
}

/* 桌面端对话框默认显示 */
.desktop-dialog {
    display: block;
}

/* 移动端卡片列表样式 - 默认隐藏 */
.mobile-card-list {
    display: none;
}

/* 移动端卡片列表样式 */
.mobile-card-item {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ebeef5;
}

.mobile-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
}

.mobile-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.mobile-card-label {
    color: #909399;
    flex-shrink: 0;
}

.mobile-card-value {
    color: #606266;
    text-align: right;
    word-break: break-all;
}

.mobile-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #ebeef5;
}

/* 移动端全屏页面样式 */
.mobile-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f7fa;
    z-index: 2000;
    overflow-y: auto;
}

.mobile-page-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ebeef5;
    z-index: 2001;
}

.mobile-page-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
    flex: 1;
    text-align: center;
}

.mobile-page-back {
    font-size: 36px;
    color: #606266;
    cursor: pointer;
    padding: 14px;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-page-action {
    font-size: 16px;
    color: #409eff;
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 500;
}

.mobile-page-content {
    padding: 15px;
}

/* 移动端表单样式 - 上下结构 */
.mobile-form .el-form-item {
    margin-bottom: 20px;
}

.mobile-form .el-form-item__label {
    float: none;
    display: block;
    text-align: left;
    margin-bottom: 8px;
    font-weight: 500;
    color: #303133;
}

.mobile-form .el-form-item__content {
    margin-left: 0 !important;
}

.mobile-form .el-input,
.mobile-form .el-select,
.mobile-form .el-date-picker {
    width: 100%;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        width: 200px;
        z-index: 1000;
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-container {
        display: block;
    }
    
    .main-content {
        padding: 10px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar .el-input,
    .search-bar .el-select {
        width: 100% !important;
    }
    
    .search-bar .el-button {
        width: 100%;
        margin-left: 0 !important;
        height: 44px;
        font-size: 15px;
    }
    
    .mobile-card-footer .el-button {
        height: 40px;
        font-size: 14px;
        padding: 0 20px;
    }
    
    .mobile-page-action {
        font-size: 17px;
        padding: 10px 18px;
    }
    
    .mobile-page-back {
        font-size: 38px;
        padding: 16px;
        width: 52px;
        height: 52px;
    }
    
    /* 报销明细按钮样式 */
    .section-header .el-button {
        height: 40px;
        font-size: 14px;
        padding: 0 16px;
    }
    
    .el-table .el-button {
        height: 36px;
        font-size: 14px;
        padding: 0 12px;
    }
    
    .el-table .el-button--danger {
        min-width: 60px;
    }
    
    /* 移动端报销明细卡片 */
    .expense-item-card {
        margin-bottom: 20px;
        border: 1px solid #e4e7ed;
        border-radius: 8px;
        background: #fafafa;
    }
    
    .expense-item-card .mobile-card-header {
        background: #f0f2f5;
        padding: 12px 15px;
        border-bottom: 1px solid #e4e7ed;
    }
    
    .expense-item-card .mobile-card-body {
        padding: 15px;
    }
    
    .delete-item-btn {
        width: 100%;
        height: 44px !important;
        font-size: 15px !important;
        margin-top: 10px;
    }
    
    .delete-item-btn .el-icon {
        margin-right: 5px;
    }
    
    /* 添加明细按钮样式 */
    .add-item-btn {
        width: 100%;
        height: 48px !important;
        font-size: 16px !important;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .add-item-btn .el-icon {
        margin-right: 5px;
        font-size: 18px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .el-table {
        font-size: 12px;
    }
    
    .el-dialog {
        width: 95% !important;
        margin: 10px auto !important;
    }
    
    .login-box {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .stat-card {
        margin-bottom: 15px;
    }
    
    /* 移动端隐藏桌面表格，显示卡片列表 */
    .desktop-table {
        display: none !important;
    }
    
    .mobile-card-list {
        display: block !important;
    }
    
    /* 移动端显示全屏页面 */
    .mobile-page {
        display: block !important;
    }
    
    /* 移动端分页简化 */
    .pagination {
        justify-content: center;
    }
    
    .el-pagination .el-pagination__sizes,
    .el-pagination .el-pagination__total {
        display: none;
    }
    
    /* 移动端表单样式 */
    .mobile-form .el-form-item {
        margin-bottom: 20px;
        display: flex;
        flex-direction: column;
    }
    
    .mobile-form .el-form-item__label {
        float: none;
        display: block;
        text-align: left;
        margin-bottom: 8px;
        font-weight: 500;
        color: #303133;
        font-size: 15px;
        padding-right: 0;
        line-height: 1.4;
    }
    
    .mobile-form .el-form-item__content {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .mobile-form .el-input,
    .mobile-form .el-select,
    .mobile-form .el-date-picker,
    .mobile-form .el-input-number {
        width: 100% !important;
    }
    
    .mobile-form .el-input__inner,
    .mobile-form .el-textarea__inner {
        height: 44px;
        font-size: 15px;
    }
    
    .mobile-form .el-textarea__inner {
        height: auto;
        min-height: 80px;
    }
    
    /* 移动端统一表单布局 */
    .mobile-page-content {
        padding: 15px;
    }
    
    .mobile-form {
        max-width: 100%;
    }
    
    .mobile-form .el-form-item__label-wrap {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 6px;
    }
    
    .mobile-form .el-form-item.is-required .el-form-item__label::before {
        margin-right: 4px;
    }
}

/* 小屏幕手机额外优化 */
@media screen and (max-width: 375px) {
    .mobile-card-item {
        padding: 12px;
    }
    
    .mobile-card-title {
        font-size: 14px;
    }
    
    .mobile-card-row {
        font-size: 13px;
    }
    
    .mobile-page-content {
        padding: 10px;
    }
}

/* iPhone 16 Pro 适配 */
@media screen and (max-width: 430px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .app-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .header {
        width: 100%;
        max-width: 100vw;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
    }
    
    .el-table {
        width: 100% !important;
    }
    
    .el-table__body-wrapper {
        overflow-x: auto;
    }
}
