/* Custom Styles for Finance Dashboard */

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0B1426;
}

::-webkit-scrollbar-thumb {
    background: #1E3A5F;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #FFB800;
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #94A3B8;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 184, 0, 0.1);
    color: #FFB800;
}

.nav-item.active {
    background: rgba(255, 184, 0, 0.15);
    color: #FFB800;
    font-weight: 500;
}

.nav-item.active .w-1 {
    background-color: #FFB800 !important;
}

/* Status Tags */
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 500;
}

/* Section Cards */
.section-card {
    background: linear-gradient(135deg, #111C30 0%, #0F1A2C 100%);
    border: 1px solid #1E3A5F;
    border-radius: 8px;
    padding: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #1E3A5F;
    margin-bottom: 0;
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Metric Cards */
.metric-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1E3A5F;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #3B82F6;
}

.metric-card.positive::before {
    background: #10B981;
}

.metric-card.danger::before {
    background: #EF4444;
}

.metric-card.warning::before {
    background: #F59E0B;
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.metric-name {
    font-size: 13px;
    color: #94A3B8;
}

.metric-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.metric-tag.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.metric-tag.neutral {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.metric-tag.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 12px;
    color: #64748B;
    margin-bottom: 4px;
}

.metric-footer {
    font-size: 11px;
    color: #475569;
    display: flex;
    justify-content: flex-end;
}

/* Mini Cards */
.mini-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1E3A5F;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.mini-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: #FFB800;
}

/* Stat Cards */
.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1E3A5F;
    border-radius: 6px;
    padding: 14px;
    text-align: center;
}

/* Signal Tags */
.signal-bull {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.signal-bear {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.signal-neutral {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Filter Tags */
.filter-tag {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid #1E3A5F;
    border-radius: 4px;
    font-size: 11px;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tag:hover {
    border-color: #FFB800;
    color: #FFB800;
}

.filter-tag.active {
    background: #FFB800;
    color: #0B1426;
    border-color: #FFB800;
}

/* Stock Rows */
.stock-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1E3A5F;
    border-radius: 6px;
    padding: 10px 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.stock-row:hover {
    background: rgba(255, 184, 0, 0.05);
    border-color: #FFB800;
}

/* Clock Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Table hover effect */
tbody tr {
    transition: background-color 0.2s ease;
}

/* Glow effect for active elements */
.glow {
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.5);
}

/* Responsive adjustments */
@media (max-width: 1280px) {
    .grid-cols-12 > [class*="col-span-"] {
        grid-column: span 12;
    }
}

/* ====== 移动端自适应 ====== */
@media (max-width: 768px) {
    /* 侧边栏：默认隐藏，通过toggle显示 */
    aside[class*="w-64"] {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px !important;
    }
    aside[class*="w-64"].sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    /* 侧边栏遮罩 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 40;
    }
    .sidebar-overlay.show {
        display: block;
    }

    /* 汉堡菜单按钮：移动端显示 */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: rgba(255,184,0,0.1);
        border: 1px solid #1E3A5F;
        border-radius: 6px;
        cursor: pointer;
        margin-right: 12px;
    }
    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
        fill: #FFB800;
    }

    /* header缩小padding */
    header[class*="px-6"] {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    header h2 {
        font-size: 16px !important;
    }

    /* 主内容区全宽 */
    main {
        width: 100% !important;
    }

    /* 网格变单列 */
    .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-6 {
        grid-template-columns: 1fr !important;
    }

    /* 卡片padding缩小 */
    .section-card, .stat-card {
        padding: 10px !important;
    }

    /* 表格横向滚动 */
    table {
        font-size: 12px;
    }
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 图表高度适配 */
    [id$="-chart"], [id$="-pie"] {
        height: 220px !important;
    }

    /* 字体缩小 */
    .text-2xl { font-size: 18px !important; }
    .text-xl { font-size: 16px !important; }
    .text-lg { font-size: 14px !important; }

    /* 输入框和按钮触摸友好 */
    input, button {
        min-height: 36px;
    }

    /* 页面内容padding缩小 */
    [class*="p-6"] {
        padding: 12px !important;
    }
}

@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
}
