/* Search Input */
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(139, 190, 85, 0.3);
    background: rgba(74, 103, 54, 0.05);
}

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

/* Servers Card */
.card {
    margin-left: 0;
    margin-right: 0;
    overflow: visible;
    width: 100%;
    padding: 24px;
}

/* Add padding to prevent footer overlap */
body {
    padding-bottom: 60px;
}

/* Servers header */
.servers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.servers-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

#serversCount {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(139, 190, 85, 0.5);
    animation: serverTitleFade 3s infinite;
}

/* Mobile layout */
@media (max-width: 768px) {
    .servers-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .servers-header h2 {
        font-size: 1.4rem;
    }

    #serversCount {
        font-size: 2rem;
    }
}

/* Desktop Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed;
}

th, td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.95rem;
    padding: 12px;
    vertical-align: top;
}

/* Column width definitions */
.col-name {
    width: 45%; /* Server name gets most space */
}

.col-ping {
    width: 6%; /* Very small - just for ping values */
}

.col-players {
    width: 8%; /* Small - just for player counts */
}

.col-connect {
    width: 8%; /* Small - just for connect button */
}

/* No. column - make it very small */
th:first-child,
td:first-child {
    width: 4%;
    text-align: center;
    font-size: 0.85rem;
    padding: 8px 4px;
}

/* Compact styling for small columns */
.col-ping, .col-players, .col-connect {
    padding: 8px 6px;
    text-align: center;
}

.col-ping {
    text-align: center;
}

.col-players {
    text-align: center;
}

.col-connect {
    text-align: center;
}

th {
    background: rgba(74, 103, 54, 0.2);
    color: var(--accent-green);
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.3s ease;
    white-space: nowrap;
    padding: 12px 8px;
}

th:hover {
    background: rgba(74, 103, 54, 0.4);
    cursor: pointer;
}

tbody tr {
    background: var(--bg-card);
}

tr:hover {
    border: 2px solid var(--accent-green);
    transform: scale(1.01);
    box-shadow: 0 0 8px rgba(74, 103, 54, 0.2);
}

tr:hover td {
    border-bottom-color: var(--accent-green);
}

.server-name {
    font-weight: bold;
    color: var(--accent-green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.players {
    color: var(--accent-red);
    font-weight: 600;
}

.map {
    color: var(--text-secondary);
}

.ping {
    color: var(--accent-green);
    font-weight: 600;
}

.description {
    color: var(--text-secondary);
    max-width: 300px;
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
    line-height: 1.4;
}

.region {
    color: var(--text-secondary);
}

.server-settings {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 400px;
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
    line-height: 1.4;
    word-wrap: break-word;
}

.connect-btn {
    background: var(--accent-green);
    color: var(--bg-dark);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.connect-btn:hover {
    background: var(--accent-darker-green);
    transform: scale(1.05);
}

/* Tablet Responsive Layout */
@media (max-width: 1200px) {
    .description {
        max-width: 250px;
    }
    
    .server-settings {
        max-width: 300px;
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 8px 4px;
        font-size: 0.9rem;
    }
    
    /* Adjust column widths for tablets */
    .col-name {
        width: 40%;
    }
    
    .col-ping {
        width: 6%;
    }
    
    .col-players {
        width: 8%;
    }
    
    .col-connect {
        width: 8%;
    }
    
    th:first-child,
    td:first-child {
        width: 4%;
        padding: 6px 2px;
    }
}

/* Mobile Responsive Table -> Card Layout */
@media (max-width: 800px) {
    .container {
        padding: 5px;
    }

    .card {
        overflow: visible;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), 0 0 5px rgba(139, 190, 85, 0.3);
        margin: 0;
        padding: 10px 5px;
        width: 100%;
    }

    .card {
        overflow: visible;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), 0 0 5px rgba(139, 190, 85, 0.3);
        margin-left: 0;
        margin-right: 0;
        padding: 16px 10px;
        width: 100%;
    }

    /* Hide table header */
    table thead {
        display: none;
    }
    
    table {
        border-collapse: separate;
        border-spacing: 0 16px;
        width: 100%;
    }

    tbody, tr, td {
        display: block;
    }

    tbody tr {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: var(--glow-green);
        overflow: hidden;
        margin-bottom: 16px;
        position: relative;
        padding: 0;
    }

    tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(74, 103, 54, 0.3);
    }

    tbody td {
        border-bottom: 1px solid rgba(74, 103, 54, 0.15);
        padding: 0;
        position: relative;
    }

    tbody td:last-child {
        border-bottom: none;
    }

    /* Add data labels for mobile */
    tbody td::before {
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 0.85rem;
        font-weight: 600;
        display: block;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Server number - small and subtle */
    tbody tr td:nth-child(1) {
        padding: 12px 16px 6px 16px;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-secondary);
        border-bottom: none;
        position: absolute;
        top: 8px;
        right: 16px;
        background: rgba(74, 103, 54, 0.2);
        border-radius: 12px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    tbody tr td:nth-child(1)::before {
        display: none;
    }

    /* Server name - prominent */
    tbody tr td:nth-child(2) {
        padding: 16px 16px 12px 16px;
        font-size: 1.1rem;
        font-weight: 600;
        border-bottom: 2px solid var(--border);
        color: var(--accent-green);
    }

    tbody tr td:nth-child(2)::before {
        display: none; /* Hide label for server name as it's obvious */
    }

    /* Stats row - ping, players, connect */
    tbody tr td:nth-child(3),
    tbody tr td:nth-child(4),
    tbody tr td:nth-child(5) {
        padding: 10px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-weight: 700;
        font-size: 1rem;
    }

    tbody tr td:nth-child(3).ping {
        color: var(--accent-green);
    }

    tbody tr td:nth-child(4).players {
        color: var(--accent-red);
    }

    /* Details section */
    tbody tr td:nth-child(6),
    tbody tr td:nth-child(7),
    tbody tr td:nth-child(8),
    tbody tr td:nth-child(9) {
        padding: 12px 16px;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    tbody tr td:nth-child(6).map {
        color: var(--text-secondary);
        font-weight: 500;
    }

    tbody tr td:nth-child(7).description {
        color: var(--text-secondary);
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        max-width: none;
    }

    tbody tr td:nth-child(8).region {
        color: var(--text-secondary);
        font-weight: 500;
    }

    tbody tr td:nth-child(9).server-settings {
        color: var(--text-secondary);
        font-size: 0.8rem;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        max-width: none;
        background: rgba(74, 103, 54, 0.1);
        border-radius: 8px;
        padding: 8px 12px;
        margin: 4px 0;
        border: 1px solid rgba(74, 103, 54, 0.3);
    }

    /* Connect button */
    .connect-btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        margin-top: 4px;
    }
}

/* Extra small screens (phones under 480px) */
@media (max-width: 480px) {
    .card {
        margin: 0;
        padding: 8px 4px;
    }

    /* Mobile cards adjustments */
    tbody tr {
        margin-bottom: 12px;
        border-radius: 12px;
    }

    tbody tr td:nth-child(2) {
        padding: 14px 12px 10px 12px;
        font-size: 1rem;
    }

    tbody tr td:nth-child(1) {
        top: 6px;
        right: 12px;
        font-size: 0.75rem;
        padding: 3px 6px;
    }

    tbody tr td:nth-child(n+3) {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    tbody tr td:nth-child(6),
    tbody tr td:nth-child(7),
    tbody tr td:nth-child(8),
    tbody tr td:nth-child(9) {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .connect-btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    tbody td::before {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }
}

/* Hide Password Checkbox Styling */
#hidePassworded, #hideServerSettings {
    display: none;
}

#hidePassworded + label, #hideServerSettings + label {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary);
    padding-left: 40px;
    line-height: 24px;
    transition: color 0.3s ease;
    margin-right: 20px;
}

#hidePassworded + label:before, #hideServerSettings + label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    height: 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

#hidePassworded + label:after, #hideServerSettings + label:after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#hidePassworded:checked + label:before, #hideServerSettings:checked + label:before {
    background: rgba(139, 190, 85, 0.1);
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(139, 190, 85, 0.3);
}

#hidePassworded:checked + label:after, #hideServerSettings:checked + label:after {
    left: 20px;
    background: var(--accent-green);
}

#hidePassworded + label:hover:before, #hideServerSettings + label:hover:before {
    border-color: var(--accent-green);
    box-shadow: 0 0 6px rgba(139, 190, 85, 0.2);
}

/* Add background to desktop table rows */
@media (min-width: 801px) {
    tbody tr {
        background: var(--bg-card);
        border-radius: 8px;
        margin-bottom: 8px;
        transition: all 0.3s ease;
    }
    
    tbody tr:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(74, 103, 54, 0.25);
    }
}