/* CRITICAL FIX: Ensure mobile browser can scroll smoothly in admin panel */
html, body.admin-body {
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

@media (max-width: 768px) {
    html, body.admin-body {
        height: auto !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }
    .admin-container {
        min-height: 100vh !important;
        overflow-y: visible !important;
        position: static !important;
    }
}

/* ==============================================================================
   BEHEERSYSTEEM & MODEREER TOOL STYLING (Admin & Moderator Dashboard)
   ============================================================================== */

.admin-body {
    background-color: #080b11;
    color: #f1f5f9;
    min-height: 100vh;
}

.admin-header {
    background: #0d121f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.admin-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
    gap: 12px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-height: 40px;
    border-radius: 8px;
    overflow: hidden;
}

.admin-brand-icon img {
    max-height: 38px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
}

.admin-brand h1 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: #f8fafc;
}

.admin-top-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.admin-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-action-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-action-btn.primary {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.admin-action-btn.primary:hover {
    background: rgba(56, 189, 248, 0.22);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.admin-action-btn.danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.admin-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.22);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.admin-tab-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.admin-tab-bar::-webkit-scrollbar {
    height: 4px;
}

.admin-tab-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.admin-nav-btn {
    padding: 7px 13px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #141c2c;
    color: #94a3b8;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.admin-nav-btn:hover, .admin-nav-btn.active {
    background: #1e293b;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.admin-nav-btn.active {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    color: #fff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.badge-status-pill {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 9999px;
    text-transform: uppercase;
    display: inline-block;
}

.badge-status-pill.active {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid #ef4444;
    color: #fca5a5;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.badge-status-pill.inactive {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* --- KPI Stats Row --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.stat-info h3 {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- Panel Sections --- */
.admin-card {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-search-input {
    padding: 8px 14px;
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    min-width: 260px;
}

.card-search-input:focus {
    border-color: #ef4444;
}

/* --- Data Table --- */
.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.admin-table th {
    background: #172033;
    padding: 12px 14px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.geo-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    font-size: 0.74rem;
    font-weight: 600;
}

.geo-inconsistent {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.action-btn-group {
    display: flex;
    gap: 6px;
}

.btn-sm-action {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a2336;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sm-action:hover {
    background: #25334d;
    color: #fff;
}

.btn-sm-action.danger:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.btn-sm-action.warning:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.btn-sm-action.purple:hover {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}

/* --- GEO Dossier Modal View --- */
.geo-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .geo-modal-grid {
        grid-template-columns: 1fr;
    }
}

.geo-data-card {
    background: #0b0f19;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
}

.geo-data-card h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.geo-item-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.geo-label {
    color: #64748b;
    font-weight: 500;
}

.geo-val {
    color: #f1f5f9;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

.geo-map-container {
    width: 100%;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 14px;
}

/* Audit log list */
.audit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.audit-item {
    background: #0c111c;
    border-left: 3px solid #ef4444;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-action {
    font-weight: 700;
    color: #f87171;
}

.audit-time {
    font-size: 0.72rem;
    color: #64748b;
}

@media (max-width: 768px) {
    .admin-top-bar {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-brand h1 {
        font-size: 0.95rem;
    }
    .admin-brand-icon img {
        max-height: 30px;
        max-width: 120px;
    }
    .admin-tab-bar {
        padding: 6px 10px;
        gap: 5px;
        -webkit-overflow-scrolling: touch;
    }
    .admin-nav-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
        min-height: 38px;
    }
    .admin-container {
        padding: 10px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card {
        padding: 12px 14px;
        gap: 10px;
    }
    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
        border-radius: 8px;
    }
    .stat-info h3 {
        font-size: 1.1rem;
    }
    .stat-info p {
        font-size: 0.68rem;
    }
    .admin-card {
        padding: 12px;
        border-radius: 10px;
    }
    .card-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .card-search-input {
        min-width: unset;
        width: 100%;
        font-size: 0.85rem;
        padding: 10px 14px;
    }
    .admin-top-right {
        width: 100%;
        justify-content: space-between;
    }
    .admin-user-badge {
        font-size: 0.78rem;
        padding: 4px 8px;
    }
    .admin-header-actions {
        flex-wrap: wrap;
    }
    .admin-action-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
    }

    /* Table → Stacked Cards op mobiel */
    .admin-table thead {
        display: none;
    }
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }
    .admin-table tr {
        background: #0c111c;
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px 14px;
        position: relative;
    }
    .admin-table tr:hover {
        background: #111827;
    }
    .admin-table td {
        padding: 4px 0;
        border: none;
        text-align: left;
        font-size: 0.84rem;
    }
    .admin-table td::before {
        content: attr(data-label);
        display: inline-block;
        font-weight: 700;
        color: #64748b;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-right: 8px;
        min-width: 70px;
    }
    .action-btn-group {
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }
    .btn-sm-action {
        padding: 8px 12px;
        font-size: 0.78rem;
        min-height: 36px;
    }

    /* Audit log stacked */
    .audit-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Geo modal stacked */
    .geo-modal-grid {
        grid-template-columns: 1fr;
    }
    .geo-map-container {
        height: 160px;
    }
}

/* Extra kleine schermen (telefoon portrait) */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .admin-tab-bar {
        padding: 6px 8px;
        gap: 4px;
    }
    .admin-nav-btn {
        padding: 7px 10px;
        font-size: 0.74rem;
    }
    .stat-card {
        padding: 10px 12px;
    }
    .admin-container {
        padding: 8px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .admin-container {
        padding: 18px;
    }
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .card-search-input {
        min-width: 200px;
    }
}

/* --- Admin Login Modal Dialog Styling --- */
#adminLoginModal {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #f8fafc;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(239, 68, 68, 0.15);
    padding: 0;
    max-width: 460px;
    width: 92vw;
    margin: auto;
}

#adminLoginModal::backdrop {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

/* ==============================================================================
   VOLLEDIG MOBIEL THEMA VOOR ADMIN DASHBOARD
   Optimalisaties voor smartphones (iOS & Android) en tablets
   ============================================================================== */
@media screen and (max-width: 900px) {
    /* 1. Header & Branding */
    .admin-top-bar {
        padding: 10px 14px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    
    .admin-brand {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .admin-top-right {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .admin-user-badge {
        width: 100% !important;
        justify-content: space-between !important;
        background: rgba(255, 255, 255, 0.05) !important;
        padding: 6px 12px !important;
        border-radius: 8px !important;
    }

    .admin-header-actions {
        display: flex !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .admin-header-actions .admin-action-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 10px 8px !important;
        font-size: 0.85rem !important;
    }

    /* 2. Horizontale Scrollbare Tabbar (App-stijl) */
    .admin-tab-bar {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        gap: 6px !important;
        padding: 8px 12px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        scrollbar-width: none !important;
    }
    
    .admin-tab-bar::-webkit-scrollbar {
        display: none !important;
    }

    .admin-nav-btn {
        flex: 0 0 auto !important;
        padding: 10px 16px !important;
        font-size: 0.82rem !important;
        border-radius: 20px !important;
    }

    /* 3. Statistieken Cards */
    .admin-container {
        padding: 10px !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }

    .stat-card {
        padding: 10px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .stat-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 1.1rem !important;
    }

    .stat-info h3 {
        font-size: 1.15rem !important;
    }

    .stat-info p {
        font-size: 0.72rem !important;
    }

    /* 4. Tabellen omvormen naar mobiele cards */
    .admin-card {
        padding: 14px 10px !important;
        margin-bottom: 14px !important;
        border-radius: 12px !important;
    }

    .table-responsive {
        border: none !important;
        overflow: visible !important;
    }

    .admin-table thead {
        display: none !important;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block !important;
        width: 100% !important;
    }

    .admin-table tr {
        background: #0f172a !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        padding: 12px 14px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    .admin-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 6px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
        font-size: 0.88rem !important;
        text-align: right !important;
    }

    .admin-table td:last-child {
        border-bottom: none !important;
        padding-top: 10px !important;
        justify-content: flex-end !important;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: 700 !important;
        color: #94a3b8 !important;
        font-size: 0.75rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        text-align: left !important;
        flex: 1 !important;
    }

    .action-btn-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
        justify-content: flex-end !important;
    }

    .btn-sm-action {
        padding: 9px 14px !important;
        font-size: 0.82rem !important;
        min-height: 38px !important;
        border-radius: 8px !important;
    }

    /* 5. Zoek- en invoervelden */
    .card-header-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .card-search-input {
        width: 100% !important;
        min-width: unset !important;
        padding: 12px 16px !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
    }

    /* 6. Modals & Dialogs fullscreen op mobiel */
    dialog {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        padding: 16px !important;
        border-radius: 14px !important;
        margin: auto !important;
    }

    dialog .modal-header h3 {
        font-size: 1.05rem !important;
    }

    dialog .form-input,
    dialog .form-select {
        font-size: 1rem !important;
        padding: 12px !important;
    }
}
