/**
 * 自定义样式
 * 襄阳指南针广告标识有限公司 - Web报价系统
 */

/* ==================== 变量定义 ==================== */
:root {
    --primary-color: #004670;
    --primary-dark: #003555;
    --primary-light: #0066a0;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* ==================== 基础样式 ==================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: var(--gray-100);
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== 导航栏 ==================== */
.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.15);
}

.navbar-dark .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.5);
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    background: #fff;
    min-height: calc(100vh - 56px);
    border-right: 1px solid var(--gray-200);
    padding-top: 1rem;
}

.sidebar .nav-link {
    color: var(--gray-600);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin: 0.25rem 0.75rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: var(--gray-100);
    color: var(--primary-color);
}

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

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 0.5rem;
}

/* ==================== 卡片样式 ==================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-title {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--gray-800);
}

/* ==================== 按钮样式 ==================== */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

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

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

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: #fff;
}

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

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* ==================== 表格样式 ==================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--gray-50);
}

/* ==================== 表单样式 ==================== */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
}

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

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

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

.badge-draft {
    background-color: var(--gray-500);
}

.badge-submitted {
    background-color: var(--primary-color);
}

.badge-approved {
    background-color: var(--success-color);
}

.badge-rejected {
    background-color: var(--danger-color);
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-card.stat-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #15803d 100%);
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
}

.stat-card.stat-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0e7490 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ==================== 报价单明细表格 ==================== */
.quote-table {
    font-size: 0.9rem;
}

.quote-table thead th {
    background-color: var(--gray-100);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.quote-table .form-control,
.quote-table .form-select {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

/* 报价明细表格自适应 */
.quote-items-table {
    table-layout: auto;
    width: 100%;
}

.quote-items-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.quote-items-table td:hover {
    white-space: normal;
    overflow: visible;
}

.quote-items-table .form-control,
.quote-items-table .form-select {
    width: 100%;
    min-width: unset;
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
}

.quote-items-table .form-select {
    padding-right: 1.5rem;
}

/* 横向滚动 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.quote-row {
    transition: background-color 0.2s ease;
}

.quote-row:hover {
    background-color: rgba(37, 99, 235, 0.02);
}

/* ==================== 时间线样式 ==================== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background-color: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ==================== Toast 提示 ==================== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1060;
}

.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==================== 模态框样式 ==================== */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* ==================== 分页样式 ==================== */
.pagination {
    margin: 0;
}

.page-link {
    color: var(--gray-600);
    border-radius: 6px;
    margin: 0 2px;
    padding: 0.5rem 0.75rem;
}

.page-link:hover {
    color: var(--primary-color);
    background-color: var(--gray-100);
}

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

/* ==================== 标签页样式 ==================== */
.nav-tabs {
    border-bottom: 2px solid var(--gray-200);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--gray-600);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: none;
}

/* ==================== 图表容器 ==================== */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 250px;
    padding: 1rem 0;
    border-bottom: 2px solid var(--gray-300);
    border-left: 2px solid var(--gray-300);
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 80px;
}

.bar {
    width: 40px;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 5px;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
    text-align: center;
}

.bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

/* ==================== 饼图 ==================== */
.pie-chart {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin: 0 auto;
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* ==================== 打印样式 ==================== */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    body {
        background: #fff;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .quote-print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 2rem;
    }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 56px;
        width: 280px;
        height: calc(100vh - 56px);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .quote-table .form-control,
    .quote-table .form-select {
        min-width: 80px;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand span {
        display: none;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* 移动端大按钮 */
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* 移动端表单输入优化 */
    .form-control, .form-select {
        padding: 0.75rem 1rem;
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* ==================== 动画效果 ==================== */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ==================== 辅助类 ==================== */
.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.bg-light-primary {
    background-color: rgba(37, 99, 235, 0.1) !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* 下拉选择器优化 */
.select2-container {
    width: 100% !important;
}
