* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --bg-dark: #0a0e1a;
    --bg-card: #1a1f35;
    --bg-card-hover: #232942;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #2d3548;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Toolbar */
.toolbar {
    background: rgba(26, 31, 53, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px var(--shadow);
}

.toolbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.manage-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.manage-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Main Content */
main {
    flex: 1;
    padding: 3rem 0;
}

/* Stats Section */
.stats-section {
    margin-bottom: 3rem;
    margin-top: 2rem;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.stats-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.025em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(26, 31, 53, 0.8) 0%, rgba(35, 41, 66, 0.5) 100%);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.stat-bar {
    height: 8px;
    background: rgba(45, 53, 72, 0.5);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    box-shadow: 0 0 10px var(--primary-glow);
}

.stat-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.stat-bar-fill.danger {
    background: linear-gradient(90deg, var(--danger) 0%, #f87171 100%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all 0.3s ease;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success), 0 0 20px rgba(16, 185, 129, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.disconnected {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px var(--success), 0 0 20px rgba(16, 185, 129, 0.3);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 15px var(--success), 0 0 30px rgba(16, 185, 129, 0.5);
    }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    font-weight: 400;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Error */
.error {
    text-align: center;
    padding: 3rem;
    color: var(--danger);
}

/* Servers Grid */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

/* Dynamic columns based on server count */
.servers-grid[data-server-count="1"] {
    grid-template-columns: 1fr;
}

.servers-grid[data-server-count="2"] {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .servers-grid[data-server-count="2"] {
        grid-template-columns: 1fr;
    }
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.server-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px var(--primary-glow);
    background: var(--bg-card-hover);
}

.server-card:hover::before {
    transform: scaleX(1);
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.server-name {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.server-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(45, 53, 72, 0.5);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.status-online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.status-starting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.status-offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.server-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.server-connection {
    text-align: center;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 0.5rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.server-connection:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
}

.server-connection .copy-icon {
    opacity: 0.6;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: var(--primary);
}

.server-connection:hover .copy-icon {
    opacity: 1;
    transform: scale(1.1);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    transition: all 0.2s ease;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.info-value {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.game-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(45, 53, 72, 0.3);
    margin-bottom: 0.5rem;
}

.game-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.game-stat i {
    color: var(--primary);
    font-size: 0.9rem;
}

.api-setup-notice {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary);
    border-radius: 0.375rem;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.api-setup-notice i {
    color: var(--primary);
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.api-setup-notice strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.25rem;
}

.api-setup-notice code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--primary);
    font-size: 0.85em;
}

.lifespan-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.lifespan-value-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lifespan-value {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.renew-btn {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.renew-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.renew-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.extend-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.extend-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.copy-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Footer */
footer {
    background: rgba(26, 31, 53, 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .servers-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 0 1rem;
    }
}
