:root {
    --bg: #121212;
    --surface: #1E1E1E;
    --surface-hover: #2A2A2A;
    --border: #333333;
    --text: #E0E0E0;
    --muted: #A0A0A0;
    --primary: #FF0000; /* Red as per screenshot-like style (e.g., Netflix/Youtube dark mode vibes) or just standard primary */
    --primary-hover: #CC0000;
    --success: #00C853;
    --warning: #FFD600;
    --danger: #DC2626;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utilities */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--muted) !important; }
.text-info { color: #29b6f6 !important; }
.text-indigo { color: #5c6bc0 !important; }
.text-teal { color: #26a69a !important; }
.text-pink { color: #ec407a !important; }
.text-purple { color: #ab47bc !important; }
.text-orange { color: #ffa726 !important; }

.bg-surface { background-color: var(--surface); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-column { flex-direction: column; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-nav {
    padding: 1.5rem 0;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--surface-hover);
    color: #fff;
}

.nav-item.active {
    background-color: var(--surface-hover);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-icon {
    width: 24px;
    display: inline-block;
    text-align: center;
    margin-right: 0.75rem;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.admin-header {
    height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-content {
    padding: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.875rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background-color: var(--surface-hover);
    border-color: var(--text);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 999px;
}

.btn-icon-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.badge-soft-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.badge-soft-danger {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: #151515; /* Darker than surface */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #1a1a1a;
    box-shadow: 0 0 0 4px rgba(255, 0, 0, 0.15); /* Primary glow */
}

.form-control:hover {
    border-color: #555;
}

/* Custom Select Arrow */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

/* File Input */
input[type="file"].form-control {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 1rem;
    background-color: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
}

input[type="file"]::file-selector-button:hover {
    background-color: var(--border);
    color: white;
}

/* Custom Toggle Switch (Visible Checkbox) */
.form-check {
    display: flex;
    align-items: center;
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    appearance: none;
    -webkit-appearance: none;
    width: 3rem;
    height: 1.6rem;
    background-color: #2a2a2a;
    border-radius: 2rem;
    position: relative;
    cursor: pointer;
    outline: none;
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.form-check-input::after {
    content: '';
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    width: 1.1rem;
    height: 1.1rem;
    background-color: var(--muted);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.form-check-input:checked {
    background-color: rgba(255, 0, 0, 0.15); /* Red tint background */
    border-color: var(--primary);
}

.form-check-input:checked::after {
    transform: translateX(1.4rem);
    background-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.4);
}

.form-check-input:hover {
    border-color: #666;
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.form-check-label {
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    color: var(--text);
}

/* Global Checkbox Styling (Fallback) */
input[type="checkbox"]:not(.form-check-input) {
    appearance: none;
    -webkit-appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    margin-right: 0.5rem;
}

input[type="checkbox"]:not(.form-check-input):checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='18px' height='18px'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 100%;
    background-position: center;
}

/* Bootstrap Utilities Aliases */
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.d-flex { display: flex; }

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-success {
    background-color: rgba(0, 200, 83, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-warning {
    background-color: rgba(255, 214, 0, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background-color: rgba(255, 61, 0, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-primary {
    background-color: rgba(255, 0, 0, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.badge-muted {
    background-color: rgba(160, 160, 160, 0.2);
    color: var(--muted);
    border: 1px solid var(--muted);
}

/* Form Styles */
.form-card {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-help {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-check-label input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-actions {
    text-align: right;
    margin-top: 2rem;
}

/* Button Sizes */
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Mobile Utilities */
.mobile-only {
    display: none;
}

.mobile-hide {
    display: table-cell;
}

/* Action Buttons */
.action-buttons-mobile {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background-color: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.stat-label {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: var(--surface-hover);
    color: var(--text);
}

.stat-icon.primary { background-color: rgba(255, 0, 0, 0.15); color: var(--primary); }
.stat-icon.success { background-color: rgba(0, 200, 83, 0.15); color: var(--success); }
.stat-icon.warning { background-color: rgba(255, 214, 0, 0.15); color: var(--warning); }
.stat-icon.info { background-color: rgba(0, 176, 255, 0.15); color: #00B0FF; }

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table tr:last-child td {
    border-bottom: none;
}

.bg-success { background-color: rgba(0, 200, 83, 0.2); color: #69f0ae; }
.bg-danger { background-color: rgba(255, 61, 0, 0.2); color: #ff9e80; }
.bg-warning { background-color: rgba(255, 214, 0, 0.2); color: #ffff8d; }
.bg-info { background-color: rgba(0, 176, 255, 0.2); color: #80d8ff; }
.bg-secondary { background-color: rgba(158, 158, 158, 0.2); color: #e0e0e0; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: rgba(0, 200, 83, 0.1);
    border-color: rgba(0, 200, 83, 0.2);
    color: #69f0ae;
}

.alert-danger {
    background-color: rgba(255, 61, 0, 0.1);
    border-color: rgba(255, 61, 0, 0.2);
    color: #ff9e80;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }

/* Pagination */
.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
}

.page-item {
    display: inline-flex;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: 4px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.page-link:hover {
    background-color: var(--surface-hover);
    border-color: var(--text);
    color: #fff;
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-item.disabled .page-link {
    background-color: transparent;
    border-color: var(--border);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    padding: 0.5rem;
    margin-right: 1rem;
    cursor: pointer;
}

.btn-icon {
    min-width: auto;
    padding: 0.5rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
    }

    .mobile-toggle {
        display: inline-flex;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .profile-name {
        display: none;
    }

    .logout-text {
        display: none;
    }

    .header-actions .btn {
        padding: 0.5rem;
        min-width: auto;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-2-1 {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .admin-content {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    /* Server Status Mobile */
    .row {
        flex-direction: column;
    }

    .server-cards {
        flex-direction: column !important;
    }

    .mobile-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .mobile-header > div {
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        justify-content: stretch !important;
    }

    .action-buttons form,
    .action-buttons .btn {
        flex: 1;
    }

    .btn-text {
        display: inline;
    }

    .d-flex.justify-between {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }

    .d-flex.justify-between > div {
        width: 100%;
    }

    .d-flex.justify-between .btn,
    .d-flex.justify-between .btn-skew {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* Hide tables, show cards instead on tablets/mobile */
    .table-responsive {
        display: none;
    }

    .mobile-cards {
        display: block !important;
    }
}

@media (max-width: 576px) {
    .grid-2, .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .admin-content {
        padding: 0.75rem;
    }

    .card {
        padding: 0.75rem;
    }

    .header-title {
        font-size: 1rem;
    }

    .admin-header {
        padding: 0 0.75rem;
        height: 56px;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Hide button text on very small screens */
    .btn-text {
        display: none;
    }

    .action-buttons .btn {
        min-width: auto;
        padding: 0.5rem;
    }

    /* Server status mobile improvements */
    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    h4 {
        font-size: 1rem;
    }

    .input-group input {
        font-size: 0.75rem;
    }

    #logContainer {
        height: 300px !important;
        font-size: 0.75rem !important;
    }



    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .btn-lg {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block;
    }

    .mobile-hide {
        display: none !important;
    }

    /* Form responsive */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-card {
        max-width: 100%;
    }

    .form-actions {
        text-align: center;
    }

    .form-actions .btn {
        width: 100%;
    }

    .mobile-actions {
        flex-direction: column;
        width: 100%;
    }

    .mobile-actions .btn-skew,
    .mobile-actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .mobile-email {
        margin-left: 0 !important;
        margin-top: 0.25rem !important;
    }

    .mobile-full-width-form {
        width: 100% !important;
    }

    .mobile-btn-full {
        width: 100%;
    }
}

/* Mobile Card Layout */
.mobile-cards {
    display: none;
}

.mobile-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.mobile-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.mobile-card-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
}

.mobile-card-body {
    margin-bottom: 0.75rem;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.mobile-card-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.mobile-card-value {
    font-size: 0.85rem;
    color: var(--text);
    text-align: right;
}

.mobile-card-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.mobile-card-actions form {
    display: flex;
    width: 100%;
}

.mobile-card-actions .btn-skew {
    width: 100%;
    margin: 0;
    justify-content: center;
    padding: 0.6rem;
}



@media (max-width: 480px) {
    .mobile-card-actions {
        grid-template-columns: 1fr;
    }
}

.mobile-card-actions .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
}

.mobile-card-actions form {
    flex: 1;
    min-width: 100px;
}

.mobile-card-actions form .btn {
    width: 100%;
}
