/* ============================================
   MADx Hub Audit Panel Styles
   v1.0 - Unified black/red/white theme
   ============================================ */

.audit-panel {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    max-width: 1200px;
    max-height: calc(100vh - 100px);
    background: #0a0a1a;
    border: 1px solid #333;
    border-top: 2px solid #e63946;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.audit-panel-hidden {
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    pointer-events: none;
}

/* Header */
.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #222;
}

.audit-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.audit-close {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.audit-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e63946;
}

/* Tabs */
.audit-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #222;
}

.audit-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 2px solid transparent;
}

.audit-tab:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.02);
}

.audit-tab.active {
    color: #fff;
    border-bottom-color: #e63946;
}

/* Body */
.audit-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    min-height: 0;
}

/* Filters */
.audit-filters {
    margin-bottom: 12px;
}

.audit-filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: flex-end;
}

.audit-filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.audit-filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #e63946;
}

.audit-select,
.audit-date-input {
    padding: 7px 10px;
    font-size: 12px;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
}

.audit-select:focus,
.audit-date-input:focus {
    outline: none;
    border-color: #e63946;
}

.audit-search-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    border-radius: 6px;
    box-sizing: border-box;
}

.audit-search-input:focus {
    outline: none;
    border-color: #e63946;
}

.audit-search-input::placeholder {
    color: #555;
}

/* Stats bar */
.audit-stats {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: #111;
    border: 1px solid #222;
    border-left: 3px solid #e63946;
    border-radius: 6px;
    margin-bottom: 10px;
}

.audit-stat {
    font-size: 12px;
    color: #aaa;
}

.audit-stat strong {
    color: #fff;
    margin-right: 3px;
}

/* Table */
.audit-table-wrap {
    overflow-x: auto;
    max-height: calc(100vh - 380px);
    overflow-y: auto;
    border: 1px solid #222;
    border-radius: 6px;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.audit-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.audit-table th {
    background: #1a1a2e;
    color: #e63946;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #e63946;
}

.audit-table td {
    padding: 6px 10px;
    color: #ccc;
    border-bottom: 1px solid #1a1a2e;
    vertical-align: top;
}

.audit-table tbody tr:hover {
    background: rgba(230, 57, 70, 0.05);
}

.audit-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.audit-cell-wrap {
    max-width: 200px;
    white-space: normal;
    word-break: break-word;
}

.audit-cell-nowrap {
    white-space: nowrap;
}

/* Badges */
.audit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.audit-badge-pending {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.audit-badge-inspected {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.audit-priority-urgent {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.audit-priority-normal {
    background: rgba(33, 150, 243, 0.15);
    color: #2196f3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.audit-priority-low {
    background: rgba(144, 202, 249, 0.15);
    color: #90caf9;
    border: 1px solid rgba(144, 202, 249, 0.2);
}

/* Empty state */
.audit-empty {
    text-align: center;
    padding: 40px 20px;
    color: #555;
    font-size: 14px;
}

/* Footer */
.audit-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid #222;
}

.audit-row-count {
    font-size: 12px;
    color: #666;
}

.audit-export-btn {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    background: #e63946;
    border: 1px solid #e63946;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audit-export-btn:hover:not(:disabled) {
    background: #d32f3f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.audit-export-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .audit-panel {
        width: 95vw;
        top: 50px;
    }

    .audit-filter-row {
        flex-wrap: wrap;
    }

    .audit-filter-group {
        flex: 1;
        min-width: 100px;
    }
}