/* 物流园CRM系统 - 科技感主题样式 */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 登录页面 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-form .form-control {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 15px;
    transition: all 0.3s;
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 16px;
    width: 100%;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 主布局 */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--gradient-primary);
    color: white;
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

/* 侧边栏关闭按钮（移动端） */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin: 5px 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: var(--primary-color);
    transform: translateX(5px);
}

.nav-link i {
    font-size: 20px;
    width: 24px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 24px;
    min-height: 100vh;
    max-width: 1600px;
    margin-left: 260px;
    margin-right: auto;
}

/* 顶部栏 */
.topbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 18px;
    padding: 18px 28px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 移动端Logo */
.mobile-logo {
    display: none;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.mobile-logo i {
    font-size: 24px;
}

.topbar-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* PC端顶部栏样式 - 有侧边栏时不显示标题 */
.topbar-pc {
    flex: 1;
}

/* PC端顶部栏 - 有侧边栏时只显示用户信息，不显示标题 */
@media (min-width: 768px) {
    .mobile-topbar {
        display: none !important;
    }
    
    .topbar {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        padding: 12px 24px !important;
        min-height: 60px !important;
    }
    
    .topbar-pc {
        display: none !important; /* PC端有侧边栏，不显示标题 */
    }
    
    .topbar-title {
        display: none !important; /* PC端不显示标题 */
    }
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

/* 卡片 */
.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border-color: rgba(99, 102, 241, 0.2);
}

.card-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: var(--gradient-primary);
    opacity: 0.08;
    border-radius: 50%;
    transform: translate(40px, -40px);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    border-color: rgba(99, 102, 241, 0.2);
}

.stat-card:hover::before {
    opacity: 0.12;
    transform: translate(30px, -30px) scale(1.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 15px;
    background: var(--gradient-primary);
    color: white;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 表格 */
.table-responsive {
    border-radius: 15px;
    overflow: hidden;
}

.table {
    margin: 0;
}

.table thead {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.table thead th {
    border: none;
    padding: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.table tbody tr {
    transition: all 0.2s;
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.table tbody td {
    padding: 15px;
    border-color: var(--border-color);
    vertical-align: middle;
}

/* 按钮 */
.btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
}

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

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

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 表单 */
.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s;
}

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

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* 徽章 */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 12px;
}

/* 移动端退出按钮 */
.mobile-logout-btn {
    display: none;
}

/* 移动端适配 */
@media (max-width: 768px) {
    /* 基础布局调整 */
    body {
        padding-bottom: 70px; /* 为底部导航栏留出空间 */
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
        height: 100vh;
        overflow-y: auto;
        box-shadow: var(--shadow-xl);
        width: 280px;
        top: 0;
        left: 0;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close-btn {
        display: flex;
    }
    
    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    
    .sidebar.open ~ .sidebar-overlay,
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 10px;
        padding-top: 60px; /* 为顶部栏留出空间 */
        padding-bottom: 80px; /* 为底部导航栏留出空间 */
        width: 100%;
        min-height: calc(100vh - 140px);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 20px;
        min-height: auto;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 28px;
        margin: 10px 0 5px;
    }
    
    .stat-label {
        font-size: 14px;
    }
    
    /* 图表在移动端 */
    .row {
        margin: 0;
    }
    
    .col-lg-8, .col-lg-4 {
        padding: 0 10px;
        margin-bottom: 15px;
    }
    
    #trendChart, #statusChart {
        max-height: 250px !important;
    }
    
    /* 顶部栏移动端优化 */
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 998;
        border-radius: 0;
        margin-bottom: 0;
        padding: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    /* PC端隐藏移动端元素 */
    .topbar .d-none.d-md-block {
        display: none !important;
    }
    
    /* PC端隐藏用户信息（移动端） */
    .topbar .user-info {
        display: none !important;
    }
    
    .topbar-title {
        display: none !important; /* 移动端使用mobile-page-title */
    }
    
    .user-info {
        display: none; /* 移动端隐藏用户信息，节省空间 */
    }
    
    /* 移动端主内容区域需要为顶部栏留出空间 */
    .main-content {
        padding-top: 68px !important; /* 56px顶部栏 + 12px间距 */
    }
    
    /* 移动端退出按钮（已移至设置页面） */
    .mobile-logout-btn {
        display: none !important;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .dropdown {
        display: none; /* 移动端隐藏下拉菜单 */
    }
    
    /* 导航链接在移动端优化 */
    .nav-link {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .nav-link i {
        font-size: 18px;
        width: 22px;
    }
    
    /* 卡片在移动端 */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px;
        font-size: 16px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* 按钮组在移动端 */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    /* 表格容器 */
    .table-responsive {
        border-radius: 10px;
        overflow: hidden;
    }
    
    /* 表单在移动端 */
    .form-control,
    .form-select {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px;
    }
    
    /* 输入组在移动端 */
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group .btn {
        flex: 1;
        min-width: 100px;
        margin-top: 5px;
    }
    
    /* 模态框在移动端全屏 */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    
    .modal-content {
        height: 100%;
        border-radius: 0;
    }
    
    .modal-body {
        overflow-y: auto;
        max-height: calc(100vh - 200px);
    }
    
    /* 下拉菜单在移动端 */
    .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 10px;
    }
    
    /* 搜索表单在移动端 */
    .card-header form {
        width: 100%;
        margin-top: 10px;
    }
    
    .card-header .d-flex {
        flex-wrap: wrap;
    }
    
    /* 按钮在移动端 */
    .btn-sm {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    /* 模态框在移动端 */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-content {
        border-radius: 15px;
    }
    
    /* 移动端导航已移至顶部下拉菜单，详见mobile.css */
}

/* 超小屏幕优化 */
@media (max-width: 400px) {
    .topbar-title {
        font-size: 18px;
    }
    
    .user-info {
        font-size: 14px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .card-header {
        font-size: 14px;
    }
    
    .btn {
        font-size: 13px;
        padding: 6px 10px;
    }
}

.mobile-menu-btn {
    display: none;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* AI分析模态框样式 */
.ai-analysis-modal .modal-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-bottom: none;
}

.ai-analysis-content {
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
}

.ai-loading-state {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.ai-analysis-text-container {
    background: #fff;
    border-radius: 8px;
}

.ai-analysis-textarea {
    border: none !important;
    box-shadow: none !important;
    padding: 20px !important;
    background: #fafafa;
    transition: background 0.3s ease;
}

.ai-analysis-textarea:focus {
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

.ai-analysis-textarea::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* 流式输出动画 */
@keyframes typing {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-analysis-textarea {
    animation: typing 0.3s ease-in-out;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .ai-analysis-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }
    
    .ai-analysis-modal .modal-content {
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .ai-analysis-modal .modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    .ai-analysis-content {
        max-height: none;
        height: 100%;
    }
    
    .ai-analysis-textarea {
        min-height: calc(100vh - 200px);
    }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
}

/* 响应式表格 */
@media (max-width: 576px) {
    .table {
        font-size: 14px;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 10px;
    }
    
    .table tbody td {
        display: block;
        text-align: right;
        padding: 8px;
        border: none;
    }
    
    .table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--text-secondary);
    }
}
