/* ========================================
   DASHBOARD STYLES - Métricas, Cards, Gráficos
   =================/* Tab Content Styles */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dashboard Card - Mantém fixo o container */
.dashboard-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    min-height: 600px; /* Altura mínima aumentada 1.5x para manter o card estável */
}

/* Dashboard Container */
.dashboard-container {
    width: 100%;
    max-width: 600px;
    perspective: 1000px;
    margin: 0 auto;
}

.dashboard-window {
    background: white;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: rotateY(-5deg) rotateX(5deg);
    transition: transform 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    height: auto;
    min-height: 600px; /* Altura total: tabs + header + 600px content */
    max-height: 700px; /* Altura fixa */
}

.dashboard-window:hover {
    transform: rotateY(0deg) rotateX(0deg);
}

/* Window Header */
.window-header {
    background: #f8fafc;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.control.red {
    background: #ef4444;
}

.control.yellow {
    background: #f59e0b;
}

.control.green {
    background: #10b981;
}

.window-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Dashboard Content */
.dashboard-content {
    padding: 24px;
    min-height: 600px; /* Altura fixa aumentada 1.5x (400px * 1.5 = 600px) */
    max-height: 600px; /* Altura fixa - não cresce nem diminui */
    overflow-y: hidden; /* Remove scroll vertical */
    width: 100%;
    box-sizing: border-box;
}

/* Dashboard Navigation */
.dashboard-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.nav-tab {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    padding: 6px 0;
    position: relative;
    transition: color 0.2s ease;
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
}

.nav-tab:hover {
    color: #374151;
}

.nav-tab.active {
    color: #005A8A;
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    right: 0;
    height: 2px;
    background: #005A8A;
}

/* Tab Content Functionality */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile padrão: 1 coluna */
    gap: 12px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr 1fr 1fr; /* 3 colunas lado a lado para os cards */
    }
    .server-insight {
        grid-column: 1 / -1; /* Ocupa toda a largura da grid */
    }
    .load-avg-card, .connections-card, .service-card {
        grid-column: auto; /* Cada um ocupa uma coluna */
    }
}

/* Metric Cards */
.metric-card {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

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

.metric-title {
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-status {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.metric-status.positive {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.metric-status.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.metric-status.neutral {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
}

.metric-value {
    font-size: 16px;
    font-weight: 400;
    color: #111827;
    margin-bottom: 3px;
}

.metric-unit {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 6px;
}

/* Metric Charts */
.metric-chart {
    height: 24px;
}

.metric-chart svg {
    width: 100%;
    height: 100%;
}

/* Performance Chart */
.performance-chart {
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px;
    border: 1px solid #e5e7eb;
}

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

.chart-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #6b7280;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-color.primary {
    background: #3b82f6;
}

.legend-color.secondary {
    background: #10b981;
}

.main-chart {
    width: 100%;
    height: 100px;
}

/* Gauge/Semi-circle Chart Styles */
.gauge-container {
    position: relative;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gauge-svg {
    width: 100px;
    height: 50px;
}

.gauge-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 6;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: #005A8A;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 157; /* πr where r=50 (semicircle) */
    stroke-dashoffset: 78.5; /* 50% progress */
    transition: stroke-dashoffset 0.3s ease;
}

.gauge-text {
    position: absolute;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.gauge-label {
    position: absolute;
    font-size: 10px;
    color: #6b7280;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

/* Status Indicators for Dashboard Demo */
.dashboard-demo .status-indicators {
    display: flex;
    justify-content: space-around;
    margin-top: 12px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.green {
    background: #10b981;
}

.status-dot.yellow {
    background: #f59e0b;
}

.status-dot.red {
    background: #ef4444;
}

/* Host Cards */
.host-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.host-card:hover {
    border-color: #005A8A;
    box-shadow: 0 4px 12px rgba(0, 90, 138, 0.1);
}

.host-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.host-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.host-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.host-status.online {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.host-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.host-status.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.host-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.host-metric {
    text-align: center;
}

.host-metric-value {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    display: block;
    margin-bottom: 2px;
}

.host-metric-label {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
}

/* Create Host Button */
.btn-create-host {
    background: linear-gradient(135deg, #005A8A, #0074B6);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-create-host:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 90, 138, 0.3);
}

/* Performance Tab Styles */
.performance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px; /* Aumentado de 15px */
    padding-bottom: 12px; /* Aumentado de 10px */
    border-bottom: 1px solid #e5e7eb;
}

.performance-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.performance-controls {
    display: flex;
    gap: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.performance-select {
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    min-width: 100px;
}

.performance-section h4 {
    font-size: 15px; /* Aumentado de 14px */
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px; /* Aumentado de 16px */
    display: flex;
    align-items: center;
    gap: 6px;
}

.query-list {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Aumentado de 12px */
}

.query-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
}

.query-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.query-number {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.show-details {
    background: none;
    border: none;
    color: #005A8A;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.show-details:hover {
    background: #eff6ff;
    color: #0074B6;
}

.query-code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    color: #1e293b;
    background: white;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* ================================
   Audit Tab Styles
   ================================ */

.audit-timeline {
    position: relative;
    padding-left: 60px; /* Reduzido para mover linha mais à esquerda */
}

.audit-timeline::before {
    content: '';
    position: absolute;
    left: 45px; /* Movido mais à esquerda */
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px; /* Reduzido espaçamento */
    padding-bottom: 12px; /* Reduzido espaçamento */
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px; /* Ajustado para nova posição da linha */
    top: 6px;
    width: 12px; /* Aumentado de 8px para 12px */
    height: 12px; /* Aumentado de 8px para 12px */
    background: #005A8A;
    border-radius: 50%;
    border: 3px solid white; /* Borda mais espessa */
    box-shadow: 0 0 0 2px #e2e8f0;
}

.timeline-date {
    min-width: 60px;
    flex-shrink: 0;
}

.timeline-date .date {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.timeline-date .time {
    display: block;
    font-size: 11px;
    color: #64748b;
}

.timeline-event {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.timeline-event:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.event-title {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.timeline-event i {
    color: #9ca3af;
    font-size: 12px;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
}

.audit-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.audit-table td {
    font-size: 12px;
    color: #374151;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.audit-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.audit-status.success {
    background: #dcfce7;
    color: #166534;
}

.audit-status.warning {
    background: #fef3c7;
    color: #92400e;
}

.audit-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* ================================
   Alerts Tab Styles
   ================================ */

.alerts-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0px; /* Reduzido de 20px */
    line-height: 1.2;
}

.alert-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px; /* Reduzido de 16px */
    margin-bottom: 12px; /* Reduzido de 16px */
    transition: all 0.2s ease;
}

.alert-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    text-transform: lowercase;
    padding: 3px 6px; /* Reduzido padding */
    border-radius: 12px;
    margin-bottom: 6px; /* Reduzido de 8px */
}

.alert-badge.server-delay {
    background: #fef3c7;
    color: #92400e;
}

.alert-badge.server-critical {
    background: #fee2e2;
    color: #991b1b;
}

.alert-badge.server-alert {
    background: #fef3c7;
    color: #92400e;
}

.alert-badge.critical-alert {
    background: #fee2e2;
    color: #991b1b;
}

.alert-title {
    font-size: 12px; /* Reduzido de 13px */
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 6px; /* Reduzido de 8px */
    line-height: 1.3; /* Reduzido de 1.4 */
}

.alert-info {
    font-size: 11px; /* Reduzido de 12px */
    color: #64748b;
    margin-bottom: 2px; /* Reduzido de 4px */
}

.alert-detail {
    display: flex;
    align-items: center;
    gap: 6px; /* Reduzido de 8px */
    margin-bottom: 2px; /* Reduzido de 4px */
}

.alert-detail .label {
    font-size: 10px; /* Reduzido de 11px */
    color: #64748b;
    font-weight: 500;
}

.alert-detail .value {
    font-size: 10px; /* Reduzido de 11px */
    color: #374151;
}

.alert-footer {
    display: flex;
    gap: 12px; /* Reduzido de 16px */
    margin: 8px 0 6px 0; /* Reduzido margens */
    font-size: 10px; /* Reduzido de 11px */
    color: #64748b;
}

.alert-footer .comments,
.alert-footer .time {
    font-size: 10px; /* Reduzido de 11px */
    color: #64748b;
}

.assign-btn {
    background: #005A8A;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px; /* Reduzido de 6px 12px */
    font-size: 10px; /* Reduzido de 11px */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.assign-btn:hover {
    background: #0074B6;
    transform: translateY(-1px);
}

.alert-description {
    font-size: 11px;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 4px;
}

.alert-time {
    font-size: 10px;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .dashboard-window {
        transform: none;
        margin: 0 auto;
    }
    
    .dashboard-window:hover {
        transform: none;
    }
    
    .dashboard-content {
        padding: 16px;
        min-height: 350px; /* Altura fixa reduzida para mobile */
        max-height: 350px; /* Altura fixa - não cresce nem diminui */
        overflow-y: auto;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .dashboard-nav {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }
    
    .nav-tab {
        font-size: 11px;
        padding: 4px 0;
    }
    
    .host-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .alerts-content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .performance-controls {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        padding: 0 12px;
    }
    
    .dashboard-content {
        padding: 12px;
        min-height: 300px; /* Altura fixa reduzida para telas pequenas */
        max-height: 300px; /* Altura fixa - não cresce nem diminui */
        overflow-y: auto;
    }
    
    .nav-tab {
        font-size: 10px;
        padding: 3px 0;
    }
    
    .dashboard-nav {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .metric-value {
        font-size: 24px;
    }
    
    .gauge-text {
        font-size: 20px;
    }
    
    .host-card {
        padding: 16px;
    }
    
    .host-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
