/* ============================================
   Xaero Map Merger - Dark Theme Styles
   ============================================ */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --accent-secondary: #533483;
    --accent-secondary-hover: #7c4dbd;
    --border-color: #0f3460;
    --success: #00d26a;
    --warning: #ffc107;
    --info: #4fc3f7;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 60px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

*::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#app {
    height: 100%;
}

/* ---- Loading Screen ---- */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.loading-map {
    position: relative;
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.map-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.app-loading p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    padding: 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    z-index: 9999;
    text-align: center;
}

#blazor-error-ui a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

/* ---- App Layout ---- */
.app-container {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    font-size: 1.5rem;
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-collapsed .sidebar-title {
    display: none;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.75rem;
}

.sidebar-collapsed .sidebar-footer {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .app-wrapper:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }

    .app-wrapper:not(.sidebar-collapsed) .sidebar-overlay {
        display: block;
    }
}

/* ---- Nav Menu ---- */
.nav-menu {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    width: 100%;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(15, 52, 96, 0.5);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
    border-left-color: var(--accent);
    font-weight: 500;
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapsed .nav-text {
    display: none;
}

/* ---- Main Wrapper ---- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Top Bar ---- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 0.25rem;
    border: none;
    background: none;
    cursor: pointer;
}

.topbar-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.text-accent {
    color: var(--accent) !important;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* ---- Footer ---- */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ---- Cards & Sections ---- */
.welcome-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.welcome-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.welcome-content h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.welcome-content p {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.6;
}

.welcome-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-secondary);
}

.stat-icon {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.servers-icon { background: rgba(79, 195, 247, 0.15); }
.regions-icon { background: rgba(0, 210, 106, 0.15); }
.users-icon { background: rgba(233, 69, 96, 0.15); }
.merges-icon { background: rgba(83, 52, 131, 0.15); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ---- Activity List ---- */
.recent-activity-section {
    margin-top: 1.5rem;
}

.recent-activity-section h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: border-color 0.2s;
}

.activity-item:hover {
    border-color: var(--accent-secondary);
}

.activity-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.activity-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge {
    font-size: 0.75rem;
    padding: 0.2em 0.5em;
    border-radius: 6px;
    font-weight: 500;
}

.badge-added {
    background: rgba(0, 210, 106, 0.2);
    color: var(--success);
}

.badge-replaced {
    background: rgba(79, 195, 247, 0.2);
    color: var(--info);
}

/* ---- Buttons ---- */
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
    color: #fff;
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-secondary-hover));
}

.btn-outline-accent {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.btn-outline-accent:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--accent-hover);
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--text-muted);
    border-radius: 8px;
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-outline-danger {
    color: var(--accent);
    border-color: var(--accent);
    border-radius: 8px;
}

.btn-outline-danger:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--accent);
}

/* ---- Form Select (dropdown) ---- */
.form-select {
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 0.6rem 2rem 0.6rem 0.85rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23a0a0b0' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    -webkit-appearance: none;
    appearance: none;
}

.form-select:focus {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(233, 69, 96, 0.25) !important;
    outline: none;
}

.form-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ---- File Input ---- */
input[type="file"]::file-selector-button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: var(--accent-secondary);
}

/* ---- Dropdown Menus ---- */
.dropdown-menu {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    color: var(--text-secondary) !important;
    transition: background 0.15s, color 0.15s;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(15, 52, 96, 0.5) !important;
    color: var(--text-primary) !important;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: rgba(233, 69, 96, 0.15) !important;
    color: var(--accent) !important;
}

.dropdown-divider {
    border-top-color: var(--border-color) !important;
}

.dropdown-header {
    color: var(--text-muted) !important;
}

/* ---- Form Controls ---- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control {
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(233, 69, 96, 0.25) !important;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ---- Upload Form ---- */
.upload-form-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
}

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

.server-input-group .form-control {
    flex: 1;
    min-width: 200px;
}

.server-or {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    background: rgba(15, 52, 96, 0.15);
    position: relative;
}

.file-drop-zone.dragging {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.drop-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.drop-placeholder i {
    font-size: 2.5rem;
    color: var(--accent-secondary);
}

.selected-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
    font-size: 1rem;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.upload-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

/* ---- Upload Progress ---- */
.upload-progress-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1rem;
    text-align: center;
}

.upload-progress-card h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.progress-container {
    margin-bottom: 1rem;
}

.progress-bar-track {
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.progress-percent {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent);
}

.upload-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ---- Merge Result ---- */
.merge-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.result-icon {
    font-size: 2.5rem;
}

.result-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-stat {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 1rem;
}

.result-stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.result-stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-added .result-stat-value { color: var(--success); }
.stat-replaced .result-stat-value { color: var(--info); }
.stat-unchanged .result-stat-value { color: var(--text-muted); }
.stat-contribution .result-stat-value { color: var(--accent); }

.contribution-bar-container {
    margin: 0 auto 1.5rem;
    max-width: 400px;
}

.contribution-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.contribution-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent));
    border-radius: 4px;
    transition: width 1s ease;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---- Leaderboard ---- */
.leaderboard-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.leaderboard-controls .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.search-group {
    max-width: 300px;
}

.leaderboard-table-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: var(--bg-tertiary);
}

.leaderboard-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(15, 52, 96, 0.3);
    font-size: 0.95rem;
}

.leaderboard-table tbody tr {
    transition: background 0.15s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(15, 52, 96, 0.2);
}

.top-rank {
    font-weight: 600;
}

.rank-1 td { background: rgba(255, 215, 0, 0.05); }
.rank-2 td { background: rgba(192, 192, 192, 0.05); }
.rank-3 td { background: rgba(205, 127, 50, 0.05); }

.medal {
    font-size: 1.5rem;
}

.rank-number {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.player-name {
    font-weight: 500;
}

.col-rank { width: 60px; text-align: center; }
.col-contributed { text-align: right; }
.col-replaced { text-align: right; }
.col-last-upload { text-align: right; white-space: nowrap; }

.leaderboard-table th.col-contributed,
.leaderboard-table th.col-replaced,
.leaderboard-table th.col-last-upload {
    text-align: right;
}

.leaderboard-table td.col-contributed,
.leaderboard-table td.col-replaced,
.leaderboard-table td.col-last-upload {
    text-align: right;
}

.stat-badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-badge.contributed {
    background: rgba(0, 210, 106, 0.15);
    color: var(--success);
}

.stat-badge.replaced {
    background: rgba(79, 195, 247, 0.15);
    color: var(--info);
}

/* ---- Downloads ---- */
.downloads-controls {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.master-download-card {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.master-download-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.master-icon {
    font-size: 3rem;
}

.master-info {
    text-align: left;
}

.master-info h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.master-info p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.master-info span {
    font-size: 0.8rem;
}

.master-download-btn {
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
}

.backups-section h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.backup-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: border-color 0.2s;
}

.backup-item:hover {
    border-color: var(--accent-secondary);
}

.backup-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.backup-info {
    flex: 1;
    min-width: 0;
}

.backup-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.backup-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ---- Alerts ---- */
.alert {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(233, 69, 96, 0.1);
    border-color: rgba(233, 69, 96, 0.3);
    color: var(--accent);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.3);
    color: var(--warning);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ---- Loading ---- */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ---- 404 ---- */
.not-found-container {
    text-align: center;
    padding: 4rem 2rem;
}

.not-found-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.not-found-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.not-found-container p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ---- Animations ---- */
.animate-in {
    animation: fadeInUp 0.4s ease-out;
}

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

/* ---- Card (Bootstrap-style dark override) ---- */
.card {
    background-color: #16213e;
    border-color: #0f3460;
    color: #e0e0e0;
}

.card-title {
    color: #e94560;
}

/* ---- Dashboard Panels ---- */
.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .dashboard-panels {
        grid-template-columns: 1fr;
    }
}

.dashboard-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dashboard-panel-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 52, 96, 0.2);
}

.dashboard-panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.panel-icon {
    font-size: 1.2rem;
}

.dashboard-panel-body {
    padding: 0.75rem 1.25rem;
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
}

/* ---- Activity Entries ---- */
.activity-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(15, 52, 96, 0.25);
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-entry-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.activity-entry-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.activity-entry-content strong {
    color: var(--text-primary);
}

.activity-highlight {
    color: var(--success);
    font-weight: 600;
}

.activity-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ---- Contributor Entries ---- */
.contributor-entry {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(15, 52, 96, 0.25);
}

.contributor-entry:last-child {
    border-bottom: none;
}

.contributor-entry.top-1 { background: rgba(255, 215, 0, 0.04); }
.contributor-entry.top-2 { background: rgba(192, 192, 192, 0.04); }
.contributor-entry.top-3 { background: rgba(205, 127, 50, 0.04); }

.contributor-rank {
    font-size: 1.25rem;
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
}

.rank-number-sm {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.contributor-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.contributor-name {
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contributor-servers {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.contributor-regions {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--success);
    white-space: nowrap;
}

/* ---- Small Empty State ---- */
.empty-state-small {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.empty-icon-small {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.empty-state-small p {
    margin: 0;
    font-size: 0.9rem;
}

/* ---- Utilities ---- */
.text-muted {
    color: var(--text-muted) !important;
}

/* ---- Admin Panel ---- */
.admin-login {
    max-width: 450px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.admin-login h2 {
    margin-bottom: 1rem;
}

.admin-page h1 {
    margin-bottom: 0.25rem;
}

.admin-file-tree-header {
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-file-tree {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0;
}

.tree-node {
    user-select: none;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.tree-node-header:hover {
    background: rgba(15, 52, 96, 0.4);
}

.tree-toggle {
    font-size: 0.7rem;
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tree-icon {
    flex-shrink: 0;
}

.tree-label {
    font-weight: 500;
    font-size: 0.95rem;
}

.tree-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

.tree-children {
    padding-left: 1.5rem;
}

.tree-node-world .tree-node-header {
    padding: 0.4rem 1rem;
}

.tree-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem 0.35rem 2.5rem;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.tree-file:hover {
    background: rgba(15, 52, 96, 0.3);
}

.tree-file-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-file-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.tree-file-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn-tree-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.btn-tree-delete:hover {
    background: rgba(233, 69, 96, 0.2);
}

.btn-tree-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Admin tree (new collapsible) */
.tree-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    cursor: default;
    transition: background 0.15s;
}

.tree-node:hover {
    background: rgba(15, 52, 96, 0.3);
}

.tree-dimension {
    font-weight: 600;
}

.tree-world {
    font-weight: 500;
}

.tree-file {
    font-size: 0.9rem;
}

.tree-toggle {
    cursor: pointer;
    font-size: 0.7rem;
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
    user-select: none;
}

.tree-spacer {
    width: 1rem;
    flex-shrink: 0;
}

.tree-label.folder {
    font-weight: 500;
}

.tree-label.file {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.tree-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Admin Modal */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.admin-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.admin-modal h3 {
    margin-bottom: 0.75rem;
}

.admin-modal .delete-path {
    display: block;
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 0.75rem 0;
    color: var(--accent);
}

.admin-modal-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ---- Tutorial Section ---- */
.tutorial-section .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #0f3460;
    color: #e0e0e0;
    cursor: pointer;
}
.tutorial-steps {
    padding-left: 20px;
    color: #e0e0e0;
}
.tutorial-steps li {
    margin-bottom: 15px;
    line-height: 1.6;
}
.tutorial-steps code {
    background-color: #1a1a2e;
    padding: 2px 6px;
    border-radius: 4px;
    color: #e94560;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .welcome-card {
        flex-direction: column;
        text-align: center;
    }

    .welcome-actions {
        justify-content: center;
    }

    .server-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .server-input-group .form-control {
        min-width: unset;
    }

    .leaderboard-controls {
        flex-direction: column;
    }

    .search-group {
        max-width: unset;
    }

    .col-rank { width: 50px; }
    .col-contributed, .col-replaced { display: none; }

    .leaderboard-table th.col-contributed,
    .leaderboard-table th.col-replaced {
        display: none;
    }

    .leaderboard-table td.col-contributed,
    .leaderboard-table td.col-replaced {
        display: none;
    }

    .master-download-header {
        flex-direction: column;
    }

    .master-info {
        text-align: center;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
