/* ─────────────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f1419;
    color: #e1e8ed;
    line-height: 1.6;
    min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LAYOUT
   ───────────────────────────────────────────────────────────────────────────── */
.page-header {
    background: #1a1f2e;
    padding: 20px 30px;
    border-bottom: 2px solid #2d3548;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    color: #00d9ff;
}

.page-header>div {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────────────────────
   NAVIGATION
   ───────────────────────────────────────────────────────────────────────────── */
.nav-btn {
    background: #16213e;
    margin-right: 10px;
}

.nav-btn.active {
    background: #00d9ff;
    color: #1a1a2e;
}

.user-info {
    color: #888;
    margin-right: 15px;
}

.user-info strong {
    color: #00d9ff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #0f3460;
    color: #00d9ff;
    border: 1px solid #1a4d8f;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: #1a4d8f;
}

.btn-primary {
    background: #00d9ff;
    color: #1a1a2e;
    border-color: #00d9ff;
}

.btn-primary:hover {
    background: #00b8d9;
}

.btn-danger {
    background: #ff6b6b;
    color: #fff;
    border-color: #ff6b6b;
}

.btn-danger:hover {
    background: #ee5a52;
}

.btn-secondary {
    background: #555;
    color: #fff;
    border-color: #555;
}

.btn-secondary:hover {
    background: #666;
}

.btn-small {
    padding: 6px 10px;
    font-size: 13px;
    height: 34px;
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1f2e;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

thead {
    background: #16213e;
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #00d9ff;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 15px;
    border-top: 1px solid #2d3548;
}

tbody tr:hover {
    background: #16213e;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE TABLE (Sticky Actions Column)
   ───────────────────────────────────────────────────────────────────────────── */

/* 1. Ensure the container scrolls and doesn't hide overflow */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 800px;
    /* Forces scrollbar on small screens */
}




/* ─────────────────────────────────────────────────────────────────────────────
   BADGES
   ───────────────────────────────────────────────────────────────────────────── */
.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    margin: 2px;
}

.badge-active {
    background: #4ecca3;
    color: #1a1a2e;
}

.badge-inactive {
    background: #555;
    color: #fff;
}

.badge-sent {
    background: #00d9ff;
    color: #1a1a2e;
}

.badge-completed {
    background: #4ecca3;
    color: #1a1a2e;
}

.badge-failed {
    background: #ff6b6b;
    color: #fff;
}

.badge-pending {
    background: #ffd93d;
    color: #1a1a2e;
}

.badge-cancelled {
    background: #888;
    color: #fff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    background: #16213e;
    border: 1px solid #2d3548;
    border-radius: 6px;
    color: #00d9ff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 42px;
    text-align: center;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination a:hover {
    background: #1f2a44;
    border-color: #00d9ff;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 217, 255, 0.2);
}

.pagination a:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination .current {
    background: linear-gradient(135deg, #00d9ff 0%, #0099cc 100%);
    color: #1a1a2e;
    font-weight: bold;
    border-color: #00d9ff;
    cursor: default;
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.pagination .disabled {
    color: #4a5568;
    background: #0f1419;
    border-color: #1a1f2e;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    opacity: 0.6;
}

.pagination-info {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-top: 15px;
    letter-spacing: 0.3px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SORTABLE COLUMNS & FAVORITES & FLAGS
   ───────────────────────────────────────────────────────────────────────────── */
.sort-link {
    color: #00d9ff;
    text-decoration: none;
    cursor: pointer;
}

.sort-link:hover {
    text-decoration: underline;
}

.sort-arrow {
    font-size: 10px;
    margin-left: 4px;
}

.fav-star {
    cursor: pointer;
    font-size: 18px;
    color: #555;
    transition: color 0.2s;
    user-select: none;
}

.fav-star.active {
    color: #ffd93d;
}

.fav-star:hover {
    color: #ffd93d;
}

.flag-icon {
    margin-right: 6px;
    border-radius: 2px;
}

.flag-cell {
    display: flex;
    align-items: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   AUDIT LOGS SPECIFIC
   ───────────────────────────────────────────────────────────────────────────── */
.filters {
    background: #16213e;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    color: #888;
}

.filter-group input,
.filter-group select {
    padding: 6px 10px;
    background: #0f3460;
    border: 1px solid #1a4d8f;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
}

.event-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.event-register {
    background: #4ecca3;
    color: #1a1a2e;
}

.event-returning {
    background: #00d9ff;
    color: #1a1a2e;
}

.event-collision {
    background: #ff6b6b;
    color: #fff;
}

.event-heartbeat {
    background: #555;
    color: #fff;
}

.event-result {
    background: #ffd93d;
    color: #1a1a2e;
}

.event-admin {
    background: #a855f7;
    color: #fff;
}

.event-error-404 {
    background: #555;
    color: #fff;
}

/* Gray for missing pages */
.event-error-auth {
    background: #ff6b6b;
    color: #fff;
}

/* Red for login failures */
.event-error-500 {
    background: #ff0000;
    color: #fff;
    font-weight: bold;
}

/* Bright red for crashes */

.details-cell {
    font-size: 12px;
    color: #aaa;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actor-cell {
    font-family: monospace;
    font-size: 12px;
}

/* FIXED: Properly closed hover rule for actor links */
.actor-cell a {
    color: #ffffff;
    text-decoration: underline dotted #555;
    transition: all 0.2s;
}

.actor-cell a:hover {
    color: #00d9ff;
    text-decoration: underline solid #00d9ff;
}

.stats-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    color: #888;
    font-size: 13px;
    flex-wrap: wrap;
}

.stats-bar strong {
    color: #00d9ff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CLIENT DETAIL (Improved Readability)
   ───────────────────────────────────────────────────────────────────────────── */
.info-box {
    background: #16213e;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #2d3548;
}

.info-box h2 {
    margin-bottom: 20px;
    color: #00d9ff;
    font-size: 18px;
    border-bottom: 1px solid #2d3548;
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 40px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #1a1f2e;
}

.info-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.info-value {
    font-size: 14px;
    color: #fff;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    word-break: break-all;
}

.info-value.monospace {
    font-family: monospace;
    font-size: 12px;
    background: #0f1419;
    padding: 4px 8px;
    border-radius: 4px;
    color: #00d9ff;
}

.info-value.unknown {
    color: #555;
    font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOGIN PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #0f1419;
}

.login-box {
    background: #1a1f2e;
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    border: 2px solid #2d3548;
}

.login-box h1 {
    color: #00d9ff;
    margin-bottom: 30px;
    text-align: center;
}

.login-box label {
    display: block;
    color: #888;
    font-size: 13px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.login-box input {
    width: 100%;
    padding: 10px;
    background: #0f3460;
    border: 1px solid #1a4d8f;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 20px;
}

.login-box input:focus {
    outline: none;
    border-color: #00d9ff;
}

.login-box button {
    width: 100%;
}

.error-msg {
    background: #ff6b6b;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY CLASSES
   ───────────────────────────────────────────────────────────────────────────── */
.text-muted {
    color: #888;
}

.text-center {
    text-align: center;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.back-link {
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    color: #888;
    padding: 40px;
}

.truncate-result {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABS (Audit vs Server Logs)
   ───────────────────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #2d3548;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: #16213e;
    color: #888;
    text-decoration: none; /* Removes underline */
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.tab:hover {
    background: #1f2a44;
    color: #fff;
}

.tab.active {
    background: #00d9ff;
    color: #1a1a2e;
    border-bottom: 2px solid #16213e; /* Covers the bottom border */
    margin-bottom: -2px; /* Pulls it down to cover the line */
}
/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────────────────────── */

/* Tablets & Small Laptops */
@media (max-width: 1024px) {
    .content {
        padding: 20px;
    }

    .page-header {
        padding: 15px 20px;
    }

    .page-header h1 {
        font-size: 20px;
    }



    th,
    td {
        padding: 10px;
        font-size: 13px;
    }

    .pagination a,
    .pagination span {
        padding: 8px 14px;
        font-size: 13px;
        min-width: 38px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .content {
        padding: 15px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }

    .info-value {
        text-align: left;
        margin-top: 8px;
        width: 100%;
        justify-content: flex-start;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
    }

    .pagination {
        gap: 6px;
    }

    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 34px;
    }

    .first-btn,
    .last-btn {
        display: none;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px;
    }

    .login-box {
        margin: 20px;
        padding: 30px 20px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .page-header>div {
        width: 100%;
        flex-direction: column;
    }

    .nav-btn,
    .btn {
        width: 100%;
        text-align: center;
    }

    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }

    .pagination {
        gap: 4px;
    }

    .pagination a,
    .pagination span {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 30px;
    }
}

/* Terminal-style output box for command results in audit logs */
.terminal-output {
    background: #0a0e14;
    color: #4ecca3;
    /* Hacker green */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #4ecca3;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    /* Preserves line breaks from ls/shell */
    word-break: break-all;
    margin-top: 5px;
}

/* Red terminal for errors */
.terminal-output.error {
    color: #ff6b6b;
    border-left-color: #ff6b6b;
}

/* Event badge for failures */
.event-failed {
    background: #ff6b6b;
    color: #fff;
}