/* 深度研报分析跟踪系统 - 自定义样式 */

/* 基础样式 */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* 图片响应式基础样式 */
img {
    max-width: 100%;
    height: auto;
}

/* Logo专用样式 */
.logo-img {
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* 防止图片变形 */
.aspect-square {
    aspect-ratio: 1 / 1;
}

.object-contain {
    object-fit: contain !important;
}

/* 桌面端隐藏移动端元素 */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    /* 确保桌面端侧边栏正常显示 */
    .sidebar-nav {
        transform: translateX(0) !important;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 基础布局调整 */
    body {
        padding-left: 0 !important;
    }
    
    /* Logo移动端优化 */
    header .flex.items-center.space-x-3 img {
        width: 2.5rem !important; /* 40px */
        height: 2.5rem !important; /* 40px */
        object-fit: contain;
        flex-shrink: 0;
    }
    
    /* 品牌区域移动端优化 */
    header .flex.items-center.space-x-3 {
        gap: 0.5rem !important;
    }
    
    header .flex.items-center.space-x-3 h1 {
        font-size: 1rem !important;
        line-height: 1.25rem !important;
    }
    
    header .flex.items-center.space-x-3 p {
        font-size: 0.625rem !important;
        line-height: 0.75rem !important;
        display: none; /* 在移动端隐藏副标题以节省空间 */
    }
    
    /* 侧边栏移动端适配 */
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-nav.mobile-open {
        transform: translateX(0);
    }
    
    /* 移动端侧边栏遮罩 */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 35;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 移动端汉堡菜单按钮 */
    .mobile-menu-btn {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 60;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 0.75rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-menu-btn:hover {
        background: #f9fafb;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* 主内容区域移动端调整 */
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        padding-top: 6rem;
    }
    
    /* 顶部导航栏移动端优化 */
    header {
        padding: 0.75rem 1rem;
    }
    
    header .flex {
        flex-wrap: wrap;
    }
    
    /* 隐藏桌面端搜索栏 */
    header .hidden.md\:flex {
        display: none !important;
    }
    
    /* 用户菜单移动端优化 */
    header .flex.items-center.space-x-4 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* 导航栏移动端适配 */
    .nav-mobile {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-mobile .nav-items {
        margin-top: 0.5rem;
        width: 100%;
        justify-content: space-between;
    }
    
    /* 卡片网格移动端适配 */
    .stats-grid,
    .grid.grid-cols-1.md\:grid-cols-3,
    .grid.grid-cols-1.md\:grid-cols-2,
    .grid.grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* 表单移动端优化 */
    .form-mobile {
        padding: 1rem;
    }
    
    /* 按钮组移动端适配 */
    .button-group-mobile,
    .flex.space-x-4,
    .flex.space-x-3 {
        flex-direction: column !important;
        gap: 0.5rem;
        space-x: 0;
    }
    
    .button-group-mobile .btn,
    .flex.space-x-4 > *,
    .flex.space-x-3 > * {
        width: 100%;
        justify-content: center;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* 研报列表移动端优化 */
    .report-item-mobile {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .report-item-mobile .report-actions {
        margin-top: 0.75rem;
        width: 100%;
        justify-content: flex-start;
    }
    
    /* 容器和间距调整 */
    .max-w-7xl,
    .max-w-6xl,
    .max-w-5xl,
    .max-w-4xl {
        max-width: 100% !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 文字大小调整 */
    .text-3xl {
        font-size: 1.875rem !important;
    }
    
    .text-2xl {
        font-size: 1.5rem !important;
    }
    
    .text-xl {
        font-size: 1.25rem !important;
    }
    
    /* 间距调整 */
    .p-8 {
        padding: 1.5rem !important;
    }
    
    .p-6 {
        padding: 1rem !important;
    }
    
    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }
    
    /* 圆角调整 */
    .rounded-2xl {
        border-radius: 1rem !important;
    }
    
    .rounded-xl {
        border-radius: 0.5rem !important;
    }
    
    .rounded-lg {
        border-radius: 0.375rem !important;
    }
    
    /* 表格移动端优化 */
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem !important;
    }
    
    /* 触摸优化 */
    button, a, input, select, textarea {
        min-height: 44px; /* 符合移动端触摸标准 */
    }
    
    /* 模态框移动端优化 */
    .modal {
        margin: 1rem !important;
        max-height: calc(100vh - 2rem) !important;
        overflow-y: auto;
    }
    
    /* 下拉菜单移动端优化 */
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 1rem !important;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    /* 工具栏移动端优化 */
    .toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .toolbar > * {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }
    
    /* 卡片内容移动端优化 */
    .card-content {
        padding: 1rem !important;
    }
    
    .card-header {
        padding: 1rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    /* 分页移动端优化 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .pagination a, .pagination span {
        min-width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 小屏幕设备额外优化 */
@media (max-width: 480px) {
    /* Logo超小屏幕优化 */
    header .flex.items-center.space-x-3 img {
        width: 2rem !important; /* 32px */
        height: 2rem !important; /* 32px */
    }
    
    header .flex.items-center.space-x-3 h1 {
        font-size: 0.875rem !important;
        line-height: 1rem !important;
    }
    
    /* 顶部导航栏紧凑布局 */
    header {
        padding: 0.5rem 0.75rem !important;
    }
    
    /* 用户菜单头像缩小 */
    header .w-10.h-10 {
        width: 2rem !important;
        height: 2rem !important;
    }
    
    /* 通知按钮调整 */
    header .relative.p-2 {
        padding: 0.375rem !important;
    }
    
    /* 更小的字体和间距 */
    .text-3xl {
        font-size: 1.5rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    /* 更紧凑的间距 */
    .p-8 {
        padding: 1rem !important;
    }
    
    .p-6 {
        padding: 0.75rem !important;
    }
    
    .py-8 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    /* 侧边栏宽度调整 */
    .sidebar-nav {
        width: 260px;
    }
    
    /* 表单元素更紧凑 */
    input, select, textarea {
        padding: 0.5rem !important;
        font-size: 1rem;
    }
    
    /* 按钮更紧凑 */
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem;
    }
}

/* 自定义组件样式 */
.upload-zone {
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: #3B82F6;
    background-color: #F8FAFC;
}

.upload-zone.dragover {
    border-color: #1D4ED8;
    background-color: #EFF6FF;
    transform: scale(1.02);
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

/* 跟踪数据卡片 */
.tracking-card {
    transition: all 0.2s ease;
}

.tracking-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* 状态指示器 */
.status-positive {
    color: #ff0101;
    background-color: #D1FAE5;
}

.status-negative {
    color: #ff0000;
    background-color: #FEE2E2;
}

.status-neutral {
    color: #01fc83;
    background-color: #F3F4F6;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式表格 */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
}

/* 文件预览 */
.file-preview {
    border: 2px dashed #D1D5DB;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.file-preview.has-file {
    border-color: #10B981;
    background-color: #F0FDF4;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #374151;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 滚动条样式 */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 #F7FAFC;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #F7FAFC;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-before: always;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* 深色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        background-color: #1F2937;
        color: #F9FAFB;
    }
    
    .dark-mode-support .bg-white {
        background-color: #374151;
    }
    
    .dark-mode-support .text-gray-900 {
        color: #F9FAFB;
    }
    
    .dark-mode-support .border-gray-200 {
        border-color: #4B5563;
    }
}

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

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* 焦点样式增强 */
.focus-enhanced:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 无障碍支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Footer 移动端优化 */
@media (max-width: 768px) {
    footer {
        margin-left: 0 !important;
        padding: 1rem !important;
    }
    
    footer .flex {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }
    
    footer .space-x-6 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    footer .hidden {
        display: none;
    }
}

/* 系统设置页面移动端优化 */
@media (max-width: 768px) {
    /* 选项卡按钮优化 */
    .tab-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
        min-width: 0;
        flex: 1;
    }
    
    .tab-button i {
        margin-right: 0.25rem;
        font-size: 0.875rem;
    }
    
    /* 表单输入框优化 */
    .modern-card input[type="text"],
    .modern-card input[type="email"],
    .modern-card input[type="number"],
    .modern-card textarea,
    .modern-card select {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 按钮优化 */
    .modern-card button {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* 系统统计卡片优化 */
    .modern-card .flex.items-center {
        flex-direction: column;
        text-align: center;
    }
    
    .modern-card .flex.items-center .ml-5 {
        margin-left: 0;
        margin-top: 0.75rem;
    }
    
    /* 维护工具卡片优化 */
    .bg-gray-50.rounded-lg {
        padding: 1rem;
    }
    
    .bg-gray-50.rounded-lg h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .bg-gray-50.rounded-lg p {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 640px) {
    /* 超小屏幕优化 */
    .tab-button span {
        display: none;
    }
    
    .tab-button i {
        margin-right: 0;
        font-size: 1rem;
    }
    
    /* 环境信息卡片单列显示 */
    .grid.grid-cols-1.sm\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .high-contrast {
        border: 2px solid;
    }
    
    .high-contrast .text-gray-500 {
        color: #000000;
    }
    
    .high-contrast .bg-gray-50 {
        background-color: #FFFFFF;
    }
}

/* 移动端优化 - 系统设置页面 */
@media (max-width: 768px) {
    /* 选项卡按钮优化 */
    .tab-button {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 0;
        flex: 1;
    }
    
    /* 表单输入框优化 */
    .form-input, .form-select {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 按钮优化 */
    .btn-primary, .btn-success, .btn-danger {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* 系统统计卡片优化 */
    .modern-card {
        padding: 16px;
    }
    
    /* 维护工具卡片优化 */
    .maintenance-card {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    /* 选项卡按钮进一步优化 */
    .tab-button {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    /* 环境信息卡片优化 */
    .env-info-card {
        padding: 12px;
    }
}

/* 移动端优化 - 用户管理、会员管理、系统日志页面 */
@media (max-width: 768px) {
    /* 搜索筛选表单优化 */
    .search-form .grid {
        gap: 12px;
    }
    
    /* 表格容器优化 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 操作按钮组优化 */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

/* 移动端优化 - 个人资料页面 */
@media (max-width: 1024px) {
    /* 个人资料网格布局优化 */
    .profile-grid {
        grid-template-columns: 1fr;
    }
    
    /* 头像卡片优化 */
    .avatar-card {
        margin-bottom: 24px;
    }
}

@media (max-width: 640px) {
    /* 个人资料表单优化 */
    .profile-form .modern-card {
        padding: 16px;
    }
    
    /* 头像尺寸优化 */
    .avatar-container {
        width: 80px;
        height: 80px;
    }
}