* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    border-radius: 10px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

.status-bar {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    color: #666;
    font-weight: 500;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.connected {
    background: #10b981;
    color: white;
}

.status-badge.disconnected {
    background: #ef4444;
    color: white;
}

.status-badge.connecting {
    background: #f59e0b;
    color: white;
}

.status-value {
    font-weight: 600;
    color: #667eea;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}

.collapsible-header:hover {
    color: #764ba2;
}

.collapse-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
    display: inline-block;
}

.collapse-icon.rotated {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.card h3 {
    color: #764ba2;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.config-item {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.config-value {
    margin-top: 8px;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-value .tag {
    display: inline-block;
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-wrapper {
    position: relative;
    min-height: 300px;
}

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

.stat-card {
    background: #f9fafb;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #667eea;
}

.stat-card h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1em;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9em;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.stat-value.success {
    color: #10b981;
}

.stat-value.error {
    color: #ef4444;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
}

.table-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-secondary {
    padding: 8px 16px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #4b5563;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

thead {
    position: sticky;
    top: 0;
    background: #667eea;
    color: white;
    z-index: 10;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

tbody tr:hover {
    background: #f9fafb;
}

.status-success {
    color: #10b981;
    font-weight: 600;
}

.status-failure {
    color: #ef4444;
    font-weight: 600;
}

.response-time {
    font-family: 'Courier New', monospace;
}

.ip-addresses {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.error-text {
    color: #ef4444;
    font-weight: 500;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 30px;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5em;
        text-align: center;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .status-item {
        justify-content: space-between;
        width: 100%;
        padding: 8px;
        background: #f9fafb;
        border-radius: 6px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .table-controls label {
        justify-content: center;
    }

    table {
        font-size: 0.75em;
    }

    th, td {
        padding: 6px 4px;
    }

    /* Ocultar columnas menos importantes en móvil */
    th:nth-child(2),
    td:nth-child(2),
    th:nth-child(7),
    td:nth-child(7) {
        display: none;
    }

    .card {
        padding: 15px;
    }

    .card h2 {
        font-size: 1.2em;
    }
}

/* Tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .config-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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