/* FitTrack Pro — Dedicated Admin Portal Styling */
:root {
    --bg-dark: #090d16;
    --bg-card: #121824;
    --bg-card-hover: #192233;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.25);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --success: #10b981;
    --warning: #f59e0b;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout Grid */
.admin-layout {
    display: none;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-layout.is-authenticated {
    display: grid;
}

/* Sidebar */
.admin-sidebar {
    background: #0d121e;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.admin-sidebar-header {
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-logo-icon {
    font-size: 1.8rem;
    background: rgba(139, 92, 246, 0.15);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.admin-logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.admin-badge-subtitle {
    font-size: 0.72rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.admin-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Custom Scrollbar for Admin Nav */
.admin-nav::-webkit-scrollbar {
    width: 5px;
}

.admin-nav::-webkit-scrollbar-track {
    background: transparent;
}

.admin-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.admin-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.4);
}

/* Collapsible Navigation Groups */
.admin-nav-group {
    display: flex;
    flex-direction: column;
}

.admin-nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0.4rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, background-color 0.2s ease;
    user-select: none;
}

.admin-nav-group-header:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.admin-nav-group-header .group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-nav-group-header .group-icon {
    font-size: 0.82rem;
    color: var(--primary);
    opacity: 0.85;
}

.admin-nav-group-header .toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.admin-nav-group:not(.open) .toggle-icon {
    transform: rotate(-90deg);
}

.admin-nav-group-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.admin-nav-group:not(.open) .admin-nav-group-items {
    display: none;
}

.admin-nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.admin-nav-item a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.admin-nav-item.active a {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(59, 130, 246, 0.15));
    color: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    margin-left: auto;
}

.admin-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn-return-app {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.65rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-return-app:hover {
    background: rgba(59, 130, 246, 0.25);
    color: white;
}

.btn-admin-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.65rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-admin-logout:hover {
    background: rgba(239, 68, 68, 0.25);
    color: white;
}

/* Main Workspace */
.admin-main {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-header-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

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

.admin-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

/* Cards & Tables */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

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

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
}

.kpi-icon {
    font-size: 1.8rem;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.kpi-val {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.kpi-lbl {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Table Design */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.admin-table th {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-warning-sm {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning-sm:hover {
    background: var(--warning);
    color: white;
}

.loading-spinner {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.btn-primary-sm {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary-sm:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.92rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Styled Select / Dropdown Elements */
select.form-control,
select,
.admin-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background-color: #121824;
    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='%2394a3b8' 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: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.92rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select.form-control:focus,
select:focus,
.admin-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #192233;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select option,
select optgroup {
    background-color: #121824;
    color: #f8fafc;
    padding: 0.6rem 1rem;
}

/* Custom Checkbox & Radio styling */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary);
    cursor: pointer;
}

/* Modal Dialog */
.admin-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.admin-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.25s ease-out;
    overflow: hidden;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.admin-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.admin-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.admin-modal-close:hover {
    color: white;
}

.admin-modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.admin-modal-body::-webkit-scrollbar {
    width: 6px;
}
.admin-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.admin-modal-body::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.4);
    border-radius: 4px;
}
.admin-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.7);
}

.admin-mobile-toggle-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Sidebar Backdrop Overlay for Mobile */
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.admin-sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Toast Notification System */
.admin-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: calc(100vw - 2rem);
}

.admin-toast {
    background: #121824;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.admin-toast.toast-success {
    border-left: 4px solid var(--success);
}

.admin-toast.toast-danger {
    border-left: 4px solid var(--danger);
}

.admin-toast.toast-info {
    border-left: 4px solid var(--primary);
}

.admin-toast.toast-warning {
    border-left: 4px solid var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Deleting element animation */
.row-deleting {
    background-color: rgba(239, 68, 68, 0.18) !important;
    opacity: 0 !important;
    transform: translateX(30px) !important;
    transition: all 0.35s ease-out !important;
}

/* Auth Verification Loading Overlay */
.admin-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1.5rem;
}

.admin-auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.15);
}

.admin-auth-icon {
    font-size: 2.8rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    display: inline-block;
    filter: drop-shadow(0 0 12px var(--primary-glow));
}

.admin-auth-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.admin-auth-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.admin-auth-spinner {
    font-size: 1.5rem;
    color: var(--primary);
}

/* Permanent Leaflet Map Timestamp Labels on Location Points */
.map-point-time-label {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(56, 189, 248, 0.5) !important;
    color: #38bdf8 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    padding: 1px 5px !important;
    border-radius: 5px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    white-space: nowrap !important;
    backdrop-filter: blur(4px) !important;
}

.map-point-time-label-dimmed {
    opacity: 0.35 !important;
    pointer-events: auto !important;
    transition: opacity 0.2s ease-in-out !important;
}

.map-point-time-label-dimmed:hover {
    opacity: 1 !important;
}

.map-point-time-label::before {
    border-top-color: rgba(15, 23, 42, 0.9) !important;
}

/* User Management Base Styles */
.admin-users-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.admin-users-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.user-actions-group {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
}

.user-actions-group button,
.user-actions-group .btn-sm {
    white-space: nowrap !important;
    word-break: normal !important;
    flex-shrink: 0;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
}

.badge-admin-role {
    color: #ef4444;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.user-cell-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-id-badge {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    font-weight: 700;
    font-size: 0.76rem;
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
}

.user-name-text {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Tablet & Navigation Drawer Breakpoint (< 900px) */
@media (max-width: 900px) {
    .admin-mobile-toggle-btn {
        display: flex;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        height: 100vh;
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
    }

    .admin-sidebar.show {
        left: 0;
    }

    .admin-main {
        padding: 1rem;
        gap: 1rem;
    }
}

/* Mobile Portrait & Small Screens Breakpoint (< 768px) */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    .admin-layout {
        grid-template-columns: 1fr !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .admin-main {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 0.75rem 0.5rem !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    .admin-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding: 0 !important;
    }

    /* Header & User Info */
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.85rem !important;
    }

    .admin-header-user {
        width: 100%;
        justify-content: flex-start;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border-color);
    }

    .admin-header-title h2 {
        font-size: 1.15rem;
    }

    .admin-users-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0.85rem;
        gap: 0.5rem;
    }

    .admin-users-header h3 {
        font-size: 0.95rem;
    }

    .admin-users-header button {
        width: auto;
        padding: 0.45rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* KPI Grid & Cards */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .kpi-card {
        padding: 0.85rem;
        gap: 0.5rem;
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .kpi-val {
        font-size: 1.2rem;
    }

    .admin-card {
        padding: 0.85rem !important;
        margin-bottom: 0.85rem !important;
        border-radius: var(--radius-md) !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    /* Modal responsiveness */
    .admin-modal-card {
        max-width: 95vw !important;
        max-height: 88vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        border-radius: var(--radius-md);
        margin: 0 auto !important;
    }

    .admin-modal-body {
        padding: 0.85rem !important;
        flex: 1 !important;
        overflow-y: auto !important;
        min-height: 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Multi-column Form Grids */
    form div[style*="grid-template-columns"],
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Table Wrappers & Card Layout */
    .table-responsive,
    .admin-table-wrapper,
    [style*="overflow-x: auto"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 0.5rem;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .admin-table tr[style*="display: none"],
    .admin-table tr[style*="display:none"],
    .admin-table tr.user-logs-expand-row[style*="display: none"],
    .admin-table tr.user-logs-expand-row[style*="display:none"] {
        display: none !important;
    }

    .admin-table thead {
        display: none !important;
    }

    .admin-table tr {
        background: rgba(18, 24, 36, 0.95);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 0.65rem 0.85rem;
        margin-bottom: 0.55rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }

    .admin-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.35rem 0 !important;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.05) !important;
        font-size: 0.82rem !important;
        text-align: right !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    .admin-table td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .admin-table td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 0.5rem;
        text-align: left;
        flex-shrink: 0;
    }

    .admin-table td.user-cell-header {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.55rem !important;
        padding-bottom: 0.45rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        margin-bottom: 0.35rem !important;
    }

    .admin-table td.user-cell-header::before {
        display: none !important;
    }

    .user-name-text {
        font-size: 1.02rem;
        color: #ffffff;
    }

    .user-cell-email {
        max-width: 65%;
        word-break: break-all;
        font-size: 0.78rem !important;
    }

    .admin-table td.user-cell-actions {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.35rem !important;
        margin-top: 0.4rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .admin-table td.user-cell-actions::before {
        display: none !important;
    }

    .user-actions-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    .user-actions-group button,
    .admin-table td .btn,
    .open-portal-log-map-btn {
        flex: 1 !important;
        width: auto !important;
        justify-content: center !important;
        padding: 0.45rem 0.3rem !important;
        font-size: 0.78rem !important;
        white-space: nowrap !important;
        border-radius: 6px !important;
    }

    .user-actions-group button span {
        font-size: 0.76rem;
    }

    /* Expanded Location Logs Row Fix for Mobile Portrait */
    .admin-table tr.user-logs-expand-row {
        display: block !important;
        width: 100% !important;
        background: rgba(15, 23, 42, 0.85) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 10px !important;
        padding: 0.75rem !important;
        margin-top: -0.2rem !important;
        margin-bottom: 0.75rem !important;
        box-sizing: border-box !important;
        box-shadow: none !important;
    }

    .admin-table tr.user-logs-expand-row > td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        white-space: normal !important;
    }

    .admin-table tr.user-logs-expand-row > td::before {
        display: none !important;
    }

    .user-logs-expand-row .nested-logs-table {
        display: table !important;
        width: 100% !important;
        min-width: 460px !important;
        border-collapse: collapse !important;
    }

    .user-logs-expand-row .nested-logs-table thead {
        display: table-header-group !important;
    }

    .user-logs-expand-row .nested-logs-table tbody {
        display: table-row-group !important;
    }

    .user-logs-expand-row .nested-logs-table tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .user-logs-expand-row .nested-logs-table td {
        display: table-cell !important;
        padding: 0.45rem 0.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        font-size: 0.78rem !important;
        text-align: left !important;
        white-space: nowrap !important;
    }

    .user-logs-expand-row .nested-logs-table td::before {
        display: none !important;
    }

    .user-logs-expand-row .nested-logs-table th {
        display: table-cell !important;
        padding: 0.45rem 0.5rem !important;
        font-size: 0.74rem !important;
        white-space: nowrap !important;
        background: #0f172a !important;
    }
}

/* Custom Database & Action Button Styling */
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.admin-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.admin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-btn.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.admin-btn.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}
