:root {
    --bg-color: #000000; /* Pure black for OLED/Dark iOS */
    --glass-bg: #1c1c1e; /* iOS Dark Card */
    --glass-border: #38383a;
    --primary-color: #0a84ff; /* iOS Dark Blue */
    --primary-hover: #007aff;
    --danger-color: #ff453a; /* iOS Dark Red */
    --danger-hover: #ff3b30;
    --text-main: #ffffff; /* iOS Light Text */
    --text-muted: #8e8e93; /* iOS Gray Text */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism Classes */
.glass-panel, .glass-header, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.glass-card {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Login Screen */
#loginScreen {
    width: 400px;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    display: none; /* hidden by default, JS toggles */
}
#loginScreen.active {
    display: block;
}

#loginScreen h2 { margin-bottom: 10px; color: var(--primary-color); }
#loginScreen p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.9rem; }
#loginScreen input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
}
#loginScreen input:focus { border-color: var(--primary-color); }

/* Buttons */
button {
    cursor: pointer;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
}
#loginBtn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 12px;
    font-size: 1rem;
}
#loginBtn:hover { background: var(--primary-hover); }

.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text-main); border: 1px solid var(--glass-border); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-danger { background: var(--danger-color); color: white; font-size: 0.8rem; padding: 6px 10px; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline { background: transparent; color: var(--text-muted); padding: 5px; font-size: 1.2rem; }
.btn-outline:hover { color: var(--danger-color); }

.error { color: var(--danger-color); font-size: 0.85rem; margin-top: 15px; min-height: 20px; }

/* Dashboard Container */
.dashboard-container {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    display: none; /* hidden by default */
    /* flex-direction removed */
}
.dashboard-container.active {
    display: flex;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px 15px 120px; /* added left padding to avoid back button overlap */
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 30px;
    border-radius: 0 0 12px 12px;
    position: relative;
}
.logo { font-size: 1.2rem; font-weight: bold; color: var(--primary-color); display: flex; align-items: center; gap: 10px;}
.user-info { display: flex; align-items: center; gap: 15px; font-size: 0.9rem;}
.back-btn {
    position: fixed;
    top: 15px;
    left: 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 14px;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}
.back-btn:hover { background: rgba(59, 130, 246, 0.1); }

/* Main Content */
.dashboard-content {
    padding: 0 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
}
.stat-info h3 { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; margin-bottom: 5px;}
.stat-info p { font-size: 1.8rem; font-weight: bold; }

/* Actions Row */
.actions-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.panel h3 { margin-bottom: 5px; color: var(--primary-color); font-size: 1.1rem;}
.panel p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 15px; }

textarea {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
    outline: none;
}
textarea:focus { border-color: var(--primary-color); }
#broadcastStatus { margin-top: 10px; margin-bottom: 0; color: #10b981; }

.server-info-list { list-style: none; margin-bottom: 20px;}
.server-info-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}
.server-info-list li:last-child { border-bottom: none; }

/* Players Table */
.full-width { grid-column: 1 / -1; }
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}
th { color: var(--text-muted); font-weight: 600; background: rgba(0,0,0,0.1); }
tr:hover { background: rgba(255,255,255,0.02); }
.empty-msg { text-align: center; color: var(--text-muted); padding: 20px !important; }

/* --- Sidebar and Tabs UI --- */
.dashboard-container {
    display: flex;
    flex-direction: column !important;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    height: 100vh;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.logout-btn {
    margin-top: auto;
    width: 100%;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
}

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

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column !important;
    }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .sidebar-logo {
        margin-bottom: 0;
    }
    .nav-links {
        flex-direction: row;
    }
    .logout-btn {
        width: auto;
        margin-top: 0;
    }
}

/* UI Styles for Drill-down Menu */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.menu-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 20px 25px;
    font-size: 1.2em;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover, .menu-btn:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    outline: 2px solid var(--primary-color);
}

/* Premium Table Styles */
.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    background: var(--glass-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid var(--glass-border);
}
.premium-table thead tr {
    background: rgba(0, 0, 0, 0.3);
}
.premium-table th {
    padding: 16px 20px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
}
.premium-table td {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
.premium-table tr:last-child td {
    border-bottom: none;
}
.premium-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Premium Inputs */
.premium-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}
.premium-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

/* New Action Buttons */
.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}
.btn-action-large {
    padding: 15px 20px;
    font-size: 1.1em;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}
.btn-action-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.btn-delete-small {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}
.btn-delete-small:hover {
    background: var(--danger-color);
    color: white;
}

/* Accessibility Focus */
*:focus-visible { outline: 4px solid #ffffff !important; outline-offset: 4px !important; border-radius: 4px; }


/* --- Mobile App UI Injection --- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.action-card {
    background-color: var(--glass-bg); border-radius: 20px; padding: 20px 15px;
    text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.1); cursor: pointer;
    transition: transform 0.1s, background-color 0.1s; display: flex; flex-direction: column;
    align-items: center; justify-content: center; border: 1px solid var(--glass-border);
}
.action-card:active { transform: scale(0.95); background-color: rgba(255,255,255,0.1); }

.icon { font-size: 32px; margin-bottom: 10px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-main); }
.card-desc { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.3; }

/* Popup Modal Block */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-block {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}
.modal-overlay.active .modal-block {
    transform: scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.modal-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.3em;
}
.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5em;
    cursor: pointer;
}
.modal-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.9em;
}
.modal-body.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* App-style List Items */
.app-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}
.app-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.app-list-info {
    flex: 1;
}
.app-list-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}
.app-list-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
}
.app-list-chevron {
    color: var(--text-muted);
    font-size: 1.5em;
    padding-left: 10px;
}

/* Smooth Scrolling */
.dashboard-content {
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
}

