/* Modern CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4ecdc4;
    --warning-color: #ffe66d;
    --danger-color: #ff6b6b;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 15px 50px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.loading-content p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Header */
.header {
    position: relative;
    background: var(--bg-gradient);
    padding: 80px 0;
    overflow: hidden;
    color: white;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="rgba(255,255,255,0.1)"><polygon points="0,0 1000,100 1000,0"/></svg>');
    background-size: cover;
}

.header-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    z-index: 2;
}

.logo-container {
    margin-bottom: 30px;
}

.logo {
    max-width: 120px;
    height: auto;
    border-radius: 50%;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.header-title h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #fff, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 30px rgba(240, 147, 251, 0.8); }
}

.header-title p {
    font-size: 1.3rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Stats Section */
.stats-section {
    padding: 60px 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    margin-top: -40px;
    position: relative;
    z-index: 1;
}

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

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

.stat-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    text-align: center;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.stat-number {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Status indicator styles removed - auto-refresh runs silently */

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Controls Section */
.controls-section {
    padding: 40px 0;
}

.controls-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: center;
}

.search-box {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    padding: 18px 20px 18px 55px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
}

.search-box input::placeholder {
    color: var(--text-light);
}

.filter-group {
    display: flex;
    gap: 15px;
}

.modern-select {
    flex: 1;
    padding: 18px 20px;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow-light);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.modern-select:hover,
.modern-select:focus {
    box-shadow: var(--shadow-medium);
    outline: none;
}

/* Server List */
.server-list {
    display: grid;
    gap: 25px;
    margin-top: 40px;
}

.server-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--bg-gradient);
}

.server-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.server-card.tcp::before {
    background: linear-gradient(45deg, var(--success-color), #26d0ce);
}

.server-card.udp::before {
    background: linear-gradient(45deg, var(--warning-color), #ff9f40);
}

.server-content {
    padding: 25px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.server-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    position: relative;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.server-icon:hover img {
    transform: scale(1.1);
}

.server-info {
    flex: 1;
}

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

.server-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.server-name:hover {
    color: var(--primary-color);
}

.version-badge {
    background: var(--dark-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.server-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.detail-item i {
    width: 16px;
    color: var(--primary-color);
}

.detail-value {
    font-weight: 500;
    color: var(--text-color);
}

.connect-address {
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.connect-address:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.motd-container {
    background: #1a1a1a;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #ffffff;
    overflow-x: auto;
}

.server-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.2);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.no-results-content i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-results-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 60px 0 20px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 20px;
    color: var(--accent-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-title h1 {
        font-size: 2.5rem;
    }
    
    .header-title p {
        font-size: 1.1rem;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .server-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .server-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .server-details {
        grid-template-columns: 1fr;
    }
    
    .server-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 50px 0;
    }
    
    .stats-section {
        padding: 40px 0;
    }
    
    .server-content {
        padding: 20px;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}