/* ==========================================================================
   ADMIN LEVELS PAGE STYLES
   ========================================================================== */

/* Outer Layout Container */
.admin-levels {
    width: min(1400px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 32px;
    box-sizing: border-box;
    min-height: calc(100vh - 88px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    color: var(--color-on-background, #ffffff);
    font-family: inherit;
}

/* Header Section */
.admin-levels-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background:
        radial-gradient(circle at top left, rgba(86, 169, 255, 0.15), transparent 30%),
        radial-gradient(circle at bottom right, rgba(247, 214, 106, 0.12), transparent 35%),
        var(--color-background, #0c1017);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.admin-levels-header h1 {
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 4px;
}

.admin-levels-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Add Level Action Button */
.add-level-button {
    background: linear-gradient(135deg, #f7d66a, #f7b32d);
    color: #18181c;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
    box-shadow: 0 4px 14px rgba(247, 214, 106, 0.25);
}

.add-level-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(247, 214, 106, 0.35);
    opacity: 0.96;
}

.add-level-button:active {
    transform: translateY(0);
}

/* Search Bar Input */
.level-search {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-on-background, #ffffff);
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.level-search:focus {
    outline: none;
    border-color: rgba(247, 214, 106, 0.8);
    box-shadow: 0 0 0 3px rgba(247, 214, 106, 0.18);
    background: rgba(255, 255, 255, 0.05);
}

.level-search::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

/* Status States (Loading, Error, Empty) */
.admin-levels .loading,
.admin-levels .empty {
    text-align: center;
    padding: 3.5rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

.admin-levels .error {
    padding: 1rem 1.25rem;
    background: rgba(222, 0, 0, 0.12);
    border: 1px solid rgba(222, 0, 0, 0.3);
    color: var(--color-error, #ff6b6b);
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
}

/* Table Container & Layout */
.levels-table {
    background:
        radial-gradient(circle at top left, rgba(86, 169, 255, 0.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 197, 87, 0.08), transparent 32%),
        var(--color-background, #0c1017);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Grid Layout for Headers and Rows */
.table-header,
.level-row {
    display: grid;
    grid-template-columns: 70px minmax(180px, 2fr) minmax(110px, 1fr) minmax(140px, 1.2fr) 110px 160px;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.5rem;
}

/* Table Header Formatting */
.table-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(247, 214, 106, 0.9);
}

/* Table Row Formatting */
.level-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.18s ease;
}

.level-row:last-child {
    border-bottom: none;
}

.level-row:hover {
    background: rgba(255, 255, 255, 0.035);
}

/* Row Columns */
.level-position {
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
}

.level-name {
    font-weight: 700;
    color: #ffffff;
    word-break: break-word;
}

/* Actions Column & Buttons */
.level-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.level-actions button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-on-background, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.level-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.level-actions .delete-button {
    background: rgba(222, 0, 0, 0.12);
    border-color: rgba(222, 0, 0, 0.25);
    color: #ff6b6b;
}

.level-actions .delete-button:hover {
    background: rgba(222, 0, 0, 0.22);
    border-color: rgba(222, 0, 0, 0.45);
}

/* Responsive Rules */
@media (max-width: 900px) {
    .table-header,
    .level-row {
        grid-template-columns: 50px minmax(140px, 1.5fr) 90px 100px 130px;
    }
    
    /* Hide Verifier on medium screens */
    .table-header span:nth-child(4),
    .level-row span:nth-child(4) {
        display: none;
    }
}

@media (max-width: 650px) {
    .admin-levels-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .add-level-button {
        width: 100%;
        text-align: center;
    }

    .table-header {
        display: none; /* Switch to card-like rows on mobile */
    }

    .level-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 1.25rem 1rem;
    }

    .level-actions {
        justify-content: flex-start;
        margin-top: 8px;
    }
}
/* Table Container & Layout */
.levels-table {
    background:
        radial-gradient(circle at top left, rgba(86, 169, 255, 0.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(255, 197, 87, 0.08), transparent 32%),
        var(--color-background, #0c1017);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Sets maximum height to fit the screen and enables vertical scrolling */
    max-height: calc(100vh - 260px);
}

/* Make the list area scrollable while keeping the header sticky */
.levels-table {
    overflow-y: auto;
}

/* Keep header fixed at the top when scrolling */
.table-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(18, 24, 35, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(247, 214, 106, 0.9);
}

/* Custom Scrollbar for the Table */
.levels-table::-webkit-scrollbar {
    width: 8px;
}

.levels-table::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

.levels-table::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.levels-table::-webkit-scrollbar-thumb:hover {
    background: rgba(247, 214, 106, 0.4);
}