/* ==========================================================================
   【新增】全局主题变量 (Theme B：现代科技 SaaS 风)
   这些变量用于覆盖全局颜色和阴影，奠定高级视觉基础
   ========================================================================== */
:root {
    --bs-primary: #6366f1; /* 科技紫：主色调 */
    --bs-primary-rgb: 99, 102, 241;
    --bs-dark: #0f172a;    /* 极暗蓝：深色背景、页头 */
    --bs-success: #10b981; /* 亮青绿：成功状态 */
    --bs-body-bg: #f8fafc; /* 极浅的蓝灰背景 */
    
    /* 圆角与阴影体系 */
    --bs-border-radius: 0.375rem; 
    --bs-border-radius-lg: 0.75rem;
    --custom-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1), 0 2px 4px -2px rgba(99, 102, 241, 0.05);
    --custom-shadow-hover: 0 10px 15px -3px rgba(99, 102, 241, 0.15), 0 4px 6px -2px rgba(99, 102, 241, 0.05);
}

/* ==========================================================================
   【新增】Bootstrap 核心组件颜色强制覆盖
   ========================================================================== */
.text-primary { color: var(--bs-primary) !important; }
.bg-primary { background-color: var(--bs-primary) !important; }
.btn-primary { background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; color: #fff !important; }
.btn-primary:hover { background-color: #4f46e5 !important; border-color: #4338ca !important; }
.btn-outline-primary { color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; }
.btn-outline-primary:hover { background-color: var(--bs-primary) !important; color: #fff !important; }

/* ==========================================================================
   【新增】高级 UI 质感提升 (卡片、按钮、表格)
   ========================================================================== */
/* 卡片悬浮质感 */
.card {
    border: none !important;
    box-shadow: var(--custom-shadow) !important;
    border-radius: var(--bs-border-radius-lg) !important;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--custom-shadow-hover) !important;
}

/* 按钮微交互 */
.btn {
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}
.btn-primary { box-shadow: 0 4px 14px 0 rgba(var(--bs-primary-rgb), 0.39); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(var(--bs-primary-rgb), 0.23); }

/* 数据表格美化 */
.table { vertical-align: middle; }
table.dataTable thead th {
    background-color: #f1f5f9; /* 浅蓝灰表头 */
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.table-striped>tbody>tr:nth-of-type(odd)>* { background-color: rgba(99, 102, 241, 0.02); } /* 条纹背景微调 */


/* ==========================================================================
   【保留 & 修改】页面基础结构
   ========================================================================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bs-body-bg); /* 【修改】使用新变量 */
}

.main-content { flex: 1; }

body.admin-view-active .main-content {
    padding-top: 70px; 
    padding-bottom: 80px; 
}

@media (max-width: 991.98px) {
    body.admin-view-active .main-content {
        padding-top: 85px;
    }
}

body.public-view-active .main-content {
    padding-top: 0;
    padding-bottom: 0;
}

/* Navbar */
.navbar-brand {
    font-weight: bold;
    display: flex; 
    align-items: center; 
}
.navbar-brand-icon {
    height: 2.5em;       
    width: auto;         
    margin-right: 8px;   
    vertical-align: text-bottom; 
}
.navbar .nav-link i, .navbar .dropdown-item i { margin-right: 8px; }
@media (min-width: 992px) {
    .navbar .nav-item.dropdown:hover .dropdown-menu {
        display: block;
        margin-top: 0;
    }
}

/* Footer */
.footer { 
    background-color: #e2e8f0; /* 【修改】更柔和的底部灰 */
    padding: 15px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #64748b;
    border-top: 1px solid #cbd5e1;
    width: 100%;
}
.footer p { margin-bottom: 0.25rem; }
.footer a { color: #64748b; text-decoration: none; }
.footer a:hover { text-decoration: underline; color: var(--bs-primary); }

/* Minimal public footer styles */
.public-footer-minimal {
    background-color: var(--bs-body-bg); /* 【修改】融合背景 */
    padding: 10px 0;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    width: 100%;
}
.public-footer-minimal p { margin-bottom: 0.25rem; }
.public-footer-minimal a { color: #64748b; text-decoration: none; }
.public-footer-minimal a:hover { text-decoration: underline; color: var(--bs-primary); }

/* DataTables Action Column */
.actions-column a, .actions-column button {
    margin-right: 0.25rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
}
.actions-column i { font-size: 0.9rem; vertical-align: middle; }
.dataTables_wrapper .row:first-child { margin-bottom: 1rem; }
table.dataTable thead th, table.dataTable thead td { white-space: nowrap; }

/* ==========================================================================
   【修改】Login Page Specific (登录页高级感重塑)
   ========================================================================== */
.login-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    width: 100%;
    /* 【新增】现代科技感渐变背景 */
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); 
}

.login-form-card {
    padding: 2.5rem 2rem;
    width: 100%;
    /* 【新增】毛玻璃效果与圆润边角 */
    border-radius: 1.5rem !important; 
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1) !important;
}

.user-table-scroll-wrapper {}

/* PDF Viewer Styles */
#pdf-display-area {}
#loading-indicator, #pdf-loading-indicator-direct {
    text-align: center;
    padding: 3rem 0;
}
#pdf-error-message, #pdf-error-message-direct, #pdf-error-message-inline {
    text-align: center;
}

.pdf-render-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f1f5f9; /* 【修改】更柔和的预览区背景 */
    padding: 10px 0;
    width: 100%;
}
.pdf-render-area canvas {
    display: block;
    margin-bottom: 15px; /* 【修改】稍微增加页间距 */
    max-width: 100%;
    width: 95%;
    height: auto !important;
    background-color: #fff;
    /* 【修改】更柔和的纸张投影 */
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); 
    border: 1px solid #e2e8f0;
}


/* ==========================================================================
   【修改】Public Page Headers (查验页权威感重塑)
   ========================================================================== */
.public-verify-header {
    background-color: var(--bs-dark); /* 【修改】深色权威头部 */
    color: #ffffff;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.public-verify-header h4 {
    margin-bottom: 0;
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: 1px;
}
.public-verify-header h4 i { margin-right: 0.5rem; color: var(--bs-primary); }

.company-info-display {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    background-color: var(--bs-primary); /* 【修改】公司名使用主色调条带 */
    padding: 10px 15px;
    font-weight: 500;
    border-bottom: none;
}
.company-info-display p { margin-bottom: 0; }


/* Floating Button for Internal Query Return */
.btn-floating-return {
    position: fixed;
    top: 110px;
    right: 25px;
    width: 50px;
    height: 50px;
    background-color: var(--bs-primary); /* 【修改】使用主题色 */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    text-decoration: none;
    box-shadow: 0 4px 14px 0 rgba(var(--bs-primary-rgb), 0.39);
    z-index: 1040;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}
.btn-floating-return:hover {
    color: white;
    background-color: #4f46e5;
    transform: scale(1.05); /* 【新增】悬浮略微放大 */
    text-decoration: none;
}

/* QR Code Modal */
#qrCodeModal .modal-body img {
    display: block;
    margin: 1rem auto;
    max-width: 80%;
    height: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 10px; /* 【新增】给二维码加点白边和圆角 */
}
#qrCodeModal .modal-body p {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: bold;
    color: #334155;
}

/* ==========================================================================
   【修改】Upload Page Dropzone Styles (上传拖拽区科技感重塑)
   ========================================================================== */
.dropzone {
    border: 2px dashed #cbd5e1; /* 【修改】更柔和的虚线 */
    border-radius: var(--bs-border-radius-lg); 
    padding: 2rem;
    background-color: #f8fafc; 
    cursor: pointer;
    transition: all .2s ease-in-out;
    min-height: 200px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.dropzone:hover {
    border-color: var(--bs-primary); 
    background-color: rgba(var(--bs-primary-rgb), 0.03); /* 【修改】微弱的主色背景 */
}
.dropzone.dragover {
    border-color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.08);
    transform: scale(1.01); /* 【新增】拖入时有吸附感 */
}

/* Wrapper for content inside dropzone to handle visibility toggle and flex centering */
.dropzone-content-wrapper {
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Common style for icons within dropzone (initial and selected state) */
.dropzone .dropzone-icon, .dropzone .dropzone-icon-selected {
    font-size: 3rem; 
    margin-bottom: 1rem; 
    transition: transform 0.3s ease;
}
.dropzone:hover .dropzone-icon {
    transform: translateY(-5px); /* 【新增】悬浮时图标上浮 */
}
.dropzone .dropzone-icon { color: var(--bs-primary); } /* 【修改】使用主题色 */
.dropzone .dropzone-icon-selected { color: var(--bs-success); margin-bottom: 0.5rem; }

/* Text within dropzone */
.dropzone-text { 
    margin-bottom: 0;
    color: #64748b; 
    font-size: 1.1rem;
}
#selected_file_name_text { 
    font-weight: 600; 
    word-break: break-all; 
    font-size: 1.1rem; 
    text-align: center;
    max-width: 90%;
}
#dropzone_file_selected_content small { 
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Style for dropzone when invalid (custom validation) */
.dropzone.is-invalid { border-color: #ef4444 !important; background-color: #fef2f2 !important; }
.dropzone.is-invalid + #pdf_file_invalid_feedback, 
#pdf_file_dropzone.is-invalid ~ #pdf_file_invalid_feedback { 
    display: block !important;
}

/* ==========================================================================
   【保留】Responsive adjustments (移动端适配)
   ========================================================================== */
@media (max-width: 768px) {
    .footer, .public-footer-minimal { font-size: 0.8rem; padding: 10px 0; }
    .pdf-render-area canvas { margin-bottom: 8px; width: 100%; }
    .btn-floating-return {
        width: 45px;
        height: 45px;
        font-size: 1.6rem;
        right: 15px;
        top: 180px;
    }
    .public-verify-header h4 { font-size: 1.1rem; }
    .company-info-display { font-size: 0.8rem; }
    .dropzone { min-height: 150px; padding: 1.5rem; }
    .dropzone .dropzone-icon, .dropzone .dropzone-icon-selected { font-size: 2.5rem; }
    .dropzone-text, #selected_file_name_text { font-size: 1rem; }
}

/* Utility class for loading spinners inside buttons */
.btn .spinner-border {
    vertical-align: middle;
    margin-left: 5px;
}
