/**
 * Node Card Modal Component Styles
 * 节点卡片放大模态框样式
 */

/* Modal Overlay */
.node-card-modal-overlay {
    --ncm-overlay-bg: color-mix(in srgb, var(--bg-color) 55%, black);
    --ncm-card-bg: var(--card-bg-color);
    --ncm-muted-bg: var(--inner-surface-bg);
    --ncm-border: var(--border-color);
    --ncm-border-soft: color-mix(in srgb, var(--border-color) 70%, transparent);
    --ncm-text: var(--text-color);
    --ncm-text-muted: var(--secondary-text-color);
    --ncm-focus: var(--accent-color);
    --ncm-focus-ring: color-mix(in srgb, var(--accent-color) 22%, transparent);
    --ncm-shadow: var(--shadow-lg);
    --ncm-shadow-hover: var(--shadow-md);
    --ncm-accent-bg: color-mix(in srgb, var(--accent-color) 12%, transparent);
    --ncm-status-active-bg: color-mix(in srgb, var(--success-color) 20%, transparent);
    --ncm-status-active-text: var(--success-color);
    --ncm-status-inactive-bg: color-mix(in srgb, var(--error-color) 20%, transparent);
    --ncm-status-inactive-text: var(--error-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--ncm-overlay-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.node-card-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container - 悬浮窗口样式，适应DStatus主题 */
.node-card-modal-container {
    background: var(--ncm-card-bg);
    border-radius: 16px;
    box-shadow: var(--ncm-shadow);
    border: 1px solid var(--ncm-border);
    width: 90vw;
    height: 85vh;
    min-width: 800px;
    min-height: 600px;
    max-width: 1400px;
    max-height: 900px;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(30px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 仅在开启毛玻璃时启用模糊（关闭毛玻璃时必须是纯色面板） */
body:not(.no-glassmorphism) .node-card-modal-container {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.node-card-modal-overlay.active .node-card-modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.node-card-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ncm-border);
    background: var(--ncm-card-bg);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.node-card-modal-title {
    /* font-size removed - use Tailwind text-xl */
    font-weight: 600;
    color: var(--ncm-text);
    margin: 0;
}

.node-card-modal-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Time Range Controls */
.time-range-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-range-label {
    /* font-size removed - use Tailwind text-sm */
    color: var(--ncm-text-muted);
    font-weight: 500;
}

.time-range-select {
    padding: 6px 12px;
    border: 1px solid var(--ncm-border);
    border-radius: 6px;
    background: var(--ncm-card-bg);
    color: var(--ncm-text);
    /* font-size removed - use Tailwind text-sm */
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.time-range-select:focus {
    border-color: var(--ncm-focus);
    box-shadow: 0 0 0 2px var(--ncm-focus-ring);
}

.time-range-select option {
    background: var(--ncm-card-bg);
    color: var(--ncm-text);
}

/* Close Button */
.node-card-modal-close {
    background: none;
    border: none;
    color: var(--ncm-text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-card-modal-close:hover {
    background: var(--ncm-muted-bg);
    color: var(--ncm-text);
}

.node-card-modal-close .ti {
    /* font-size removed - use Tailwind text-xl */
}

/* Modal Body */
.node-card-modal-body {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    position: relative;
}

.enlarged-node-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.enlarged-card-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    height: 100%;
}

/* Enlarged Card Header */
.enlarged-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--ncm-border);
    background: var(--ncm-muted-bg);
    border-radius: 12px;
}

/* Stats Grid */
.enlarged-card-stats {
    flex-shrink: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--ncm-card-bg);
    border: 1px solid var(--ncm-border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--ncm-shadow-hover);
    transform: translateY(-1px);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ncm-accent-bg);
}

.stat-icon .ti {
    /* font-size removed - use Tailwind text-2xl */
}

.stat-content {
    flex: 1;
}

.stat-label {
    /* font-size removed - use Tailwind text-sm */
    color: var(--ncm-text-muted);
    margin-bottom: 4px;
}

.stat-value {
    /* font-size removed - use Tailwind text-lg */
    font-weight: 600;
    color: var(--ncm-text);
}

/* Chart Area */
.enlarged-card-chart {
    flex: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    padding: 0 0 12px 0;
    border-bottom: 1px solid var(--ncm-border);
    margin-bottom: 16px;
}

.enlarged-chart-container {
    flex: 1;
    width: 100%;
    min-height: 400px;
    position: relative;
    background: var(--ncm-card-bg);
    border: 1px solid var(--ncm-border);
    border-radius: 8px;
    padding: 8px;
}

/* Targets Section */
.enlarged-card-targets {
    flex-shrink: 0;
}

.targets-header {
    padding: 0 0 12px 0;
    border-bottom: 1px solid var(--ncm-border);
    margin-bottom: 16px;
}

.targets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.target-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ncm-card-bg);
    border: 1px solid var(--ncm-border);
    border-radius: 8px;
}

.target-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.target-name {
    font-weight: 500;
    color: var(--ncm-text);
}

.target-status {
    padding: 2px 8px;
    border-radius: 12px;
    /* font-size removed - use Tailwind text-xs */
    font-weight: 500;
}

.target-status.active {
    background: var(--ncm-status-active-bg);
    color: var(--ncm-status-active-text);
}

.target-status.inactive {
    background: var(--ncm-status-inactive-bg);
    color: var(--ncm-status-inactive-text);
}

.target-metrics {
    display: flex;
    gap: 16px;
}

.target-metric {
    /* font-size removed - use Tailwind text-sm */
    color: var(--ncm-text-muted);
}

/* Ensure Tailwind dark classes work properly within modal context */
.dark .node-card-modal-overlay .text-slate-800 {
    color: var(--ncm-text) !important;
}

.dark .node-card-modal-overlay .text-slate-600 {
    color: var(--ncm-text-muted) !important;
}

.dark .node-card-modal-overlay .text-lg {
    color: inherit;
}

/* Additional dark theme text adaptations */
.dark .enlarged-card-header h4 {
    color: var(--ncm-text) !important;
}

.dark .enlarged-card-header span {
    color: var(--ncm-text-muted) !important;
}

.dark .chart-header h5 {
    color: var(--ncm-text) !important;
}

.dark .targets-header h5 {
    color: var(--ncm-text) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .node-card-modal-container {
        width: 95vw;
        height: 90vh;
        min-width: 600px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .node-card-modal-container {
        width: 100vw;
        height: 100vh;
        min-width: 350px;
        border-radius: 0;
    }
    
    .node-card-modal-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .node-card-modal-controls {
        justify-content: space-between;
    }
    
    .enlarged-card-content {
        padding: 16px;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 12px 16px;
    }
    
    .target-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .target-metrics {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .enlarged-card-content {
        padding: 8px;
        gap: 12px;
    }
    
    .node-card-modal-header {
        padding: 12px 16px;
    }

    /* 移动端去除外围留白，扩大有效绘图区 */
    .node-card-modal-overlay { padding: 0; }
    .enlarged-chart-container { padding: 4px; }
}

/* 优化触摸设备上的交互 */
@media (hover: none) and (pointer: coarse) {
    .node-card-modal-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .time-range-select {
        min-height: 44px;
    }
    
    .node-card-modal-container {
        touch-action: manipulation;
    }
}
