/* ===== Sorting Form ===== */
.sorting-container {
    margin: 1.5rem 0 2rem;
    display: flex;
    justify-content: flex-end;
}

.sort-form {
    display: inline-block;
}

.sort-form-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sort-label {
    font-size: 0.875rem;
    color: #cbd5e1;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sort-select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-size: 0.875rem;
    color: #f1f5f9;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px;
    min-width: 160px;
}

.sort-select:hover {
    border-color: rgba(100, 116, 139, 0.5);
    background: rgba(15, 23, 42, 0.9);
}

.sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.sort-select option {
    background: #1e293b;
    color: #f1f5f9;
    padding: 0.5rem;
}

/* ===== Servers Section ===== */
.servers-section {
    margin: 3rem auto;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    max-width: 1400px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.section-title {
    font-size: 1.5rem;
    color: #f1f5f9;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.pagination-info {
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

/* ===== Servers Grid - Optimized ===== */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.server-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
    padding: 1.25rem;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.server-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-color: rgba(100, 116, 139, 0.3);
}

/* Status indicator - Simple & Performant */
.server-card[data-status="online"]::before,
.server-card[data-status="offline"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 10px 0 0 10px;
}

.server-card[data-status="online"]::before {
    background: #4ade80;
}

.server-card[data-status="offline"]::before {
    background: #f87171;
}

/* ===== Server Card Header - Optimized ===== */
.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.server-meta {
    flex: 1;
    min-width: 0;
}

.server-version {
    font-size: 0.8125rem;
    color: #cbd5e1;
    font-family: 'SF Mono', monospace;
    background: rgba(30, 41, 59, 0.8);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 0.5rem;
}

.server-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
}

.server-status-badge.status-online {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.server-status-badge.status-offline {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.server-players {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(30, 41, 59, 0.8);
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    flex-shrink: 0;
}

.players-online {
    font-size: 1.125rem;
    font-weight: 700;
    color: #4ade80;
}

.players-separator {
    color: #94a3b8;
    margin: 0 0.125rem;
}

.players-max {
    font-size: 0.9375rem;
    color: #cbd5e1;
}

.players-label {
    font-size: 0.6875rem;
    color: #94a3b8;
    margin-left: 0.375rem;
}

/* ===== Server Card Body ===== */
.server-card-body {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.server-motd {
    color: #e2e8f0;
    line-height: 1.5;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Server Card Footer ===== */
.server-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    gap: 0.75rem;
}

.server-address {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.address-label {
    color: #94a3b8;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.server-ip {
    font-family: 'SF Mono', monospace;
    color: #7dd3fc;
    background: rgba(30, 41, 59, 0.8);
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.server-last-seen {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #94a3b8;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ===== Pagination - Optimized ===== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination-btn:hover {
    background: rgba(30, 41, 59, 1);
    border-color: rgba(100, 116, 139, 0.4);
    transform: translateY(-1px);
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-numbers a,
.pagination-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
}

.pagination-numbers a {
    background: rgba(30, 41, 59, 0.6);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.pagination-numbers a:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.pagination-current {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.pagination-ellipsis {
    color: #94a3b8;
    padding: 0 0.5rem;
}

/* ===== Server Card Action Button ===== */
.server-card-action {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.server-details-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(30, 41, 59, 0.8);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.server-details-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.server-details-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.server-details-btn:hover .btn-icon {
    transform: translateX(2px);
}

/* Optional: Add different button styles based on server status */
.server-card[data-status="online"] .server-details-btn:hover {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
}

.server-card[data-status="offline"] .server-details-btn:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
}

/* ===== Responsive Adjustments for Button ===== */
@media (max-width: 768px) {
    .server-card-action {
        margin-top: 0.875rem;
        padding-top: 0.875rem;
    }
    
    .server-details-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .server-details-btn {
        padding: 0.5rem 0.75rem;
    }
}

/* ===== Responsive Breakpoints - Optimized ===== */
@media (max-width: 768px) {
    .sorting-container {
        justify-content: flex-start;
        margin: 1rem 0 1.5rem;
    }
    
    .sort-form-group {
        width: 100%;
    }
    
    .sort-select {
        min-width: 100%;
    }
    
    .servers-section {
        padding: 1rem;
        margin: 2rem 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .pagination-info {
        align-self: flex-start;
    }
    
    .servers-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .server-card {
        padding: 1rem;
    }
    
    .server-card-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .server-players {
        align-self: flex-start;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination-btn {
        width: 100%;
        justify-content: center;
    }
    
    .server-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .server-last-seen {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .server-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .server-address {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
    }
    
    .server-ip {
        width: 100%;
    }
    
    .pagination-numbers a,
    .pagination-numbers span {
        min-width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}