/* IP Pool Management Dashboard Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* API Key Section */
.api-key-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-key-section label {
    font-weight: 600;
}

.api-key-section input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.api-key-section button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.status-indicator {
    font-size: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Controls */
.controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.controls select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--danger-color);
}

.hidden {
    display: none !important;
}

/* Pool View */
.pool-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.pool-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.pool-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    text-align: center;
}

.pool-stat-item {
    padding: 10px;
    background: var(--bg-color);
    border-radius: 6px;
}

.pool-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.pool-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Node View */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.node-table {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.node-table th {
    background: var(--bg-color);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.node-table td {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.node-table tr:hover {
    background: var(--bg-color);
}

/* Delay Badge - Color coding based on latency */
.delay-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
}

/* Green: < 200ms (Excellent) */
.delay-excellent {
    background: #d1fae5;
    color: #065f46;
}

/* Light Green: 200-300ms (Good) */
.delay-good {
    background: #d9f99d;
    color: #365314;
}

/* Yellow: 300-500ms (Fair) */
.delay-fair {
    background: #fef3c7;
    color: #92400e;
}

/* Orange: 500-800ms (Poor) */
.delay-poor {
    background: #fed7aa;
    color: #9a3412;
}

/* Red: > 800ms (Bad) */
.delay-bad {
    background: #fecaca;
    color: #991b1b;
}

/* Gray: No data */
.delay-unknown {
    background: #f1f5f9;
    color: #64748b;
}

/* Status Badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
}

.status-alive {
    background: #d1fae5;
    color: #065f46;
}

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

/* Pool Badge */
.pool-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    background: var(--bg-color);
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

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

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

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

    .node-table {
        font-size: 0.9rem;
    }
}
