/**
 * VeraCita Financial Audit - Audit Trail Styles
 */

/* ============================================
   Viewer Container
   ============================================ */

.audit-trail-viewer {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ============================================
   Header
   ============================================ */

.audit-trail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.header-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.header-subtitle {
    font-size: 13px;
    color: #64748b;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   Filters
   ============================================ */

.audit-trail-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.filter-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 320px;
    padding: 8px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.filter-search svg {
    width: 18px;
    height: 18px;
    color: #94a3b8;
}

.filter-search input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: #1e293b;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
}

/* ============================================
   Content
   ============================================ */

.audit-trail-content {
    min-height: 400px;
}

.audit-trail-list {
    padding: 16px;
}

.loading-indicator {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

/* ============================================
   Entry
   ============================================ */

.audit-entry {
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.audit-entry:hover {
    border-color: #cbd5e1;
}

.audit-entry.expanded {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.entry-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.15s;
}

.entry-header:hover {
    background: #f8fafc;
}

.entry-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f5f9;
}

.entry-icon svg {
    width: 18px;
    height: 18px;
    color: #64748b;
}

/* Event type colors */
.event-create .entry-icon {
    background: #dcfce7;
}
.event-create .entry-icon svg {
    color: #16a34a;
}

.event-update .entry-icon {
    background: #dbeafe;
}
.event-update .entry-icon svg {
    color: #2563eb;
}

.event-delete .entry-icon {
    background: #fee2e2;
}
.event-delete .entry-icon svg {
    color: #dc2626;
}

.event-approve .entry-icon {
    background: #dcfce7;
}
.event-approve .entry-icon svg {
    color: #16a34a;
}

.event-reject .entry-icon {
    background: #fef3c7;
}
.event-reject .entry-icon svg {
    color: #d97706;
}

.event-signoff .entry-icon {
    background: #f3e8ff;
}
.event-signoff .entry-icon svg {
    color: #9333ea;
}

.entry-main {
    flex: 1;
}

.entry-title {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.entry-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #64748b;
}

.meta-item svg {
    width: 14px;
    height: 14px;
}

.entry-expand {
    width: 24px;
    height: 24px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.entry-expand svg {
    width: 100%;
    height: 100%;
}

.audit-entry.expanded .entry-expand {
    transform: rotate(180deg);
}

/* ============================================
   Entry Details
   ============================================ */

.entry-details {
    padding: 16px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.detail-section {
    margin-bottom: 16px;
}

.detail-section h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.changes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.changes-table th,
.changes-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.changes-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
}

.changes-table .field-name {
    font-weight: 500;
    color: #1e293b;
}

.changes-table .old-value {
    color: #dc2626;
    background: #fef2f2;
}

.changes-table .new-value {
    color: #16a34a;
    background: #f0fdf4;
}

.change-added .old-value {
    color: #94a3b8;
    background: none;
}

.change-removed .new-value {
    color: #94a3b8;
    background: none;
}

.no-changes {
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.meta-row {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.meta-label {
    color: #64748b;
}

.meta-value {
    color: #1e293b;
    font-family: monospace;
}

.meta-value.hash {
    color: #64748b;
}

/* ============================================
   Pagination
   ============================================ */

.audit-trail-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

.pagination-info {
    font-size: 13px;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-number {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
}

/* ============================================
   Buttons
   ============================================ */

.audit-trail-viewer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.audit-trail-viewer .btn svg {
    width: 18px;
    height: 18px;
}

.audit-trail-viewer .btn-primary {
    background: #3b82f6;
    color: white;
}

.audit-trail-viewer .btn-primary:hover {
    background: #2563eb;
}

.audit-trail-viewer .btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.audit-trail-viewer .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.audit-trail-viewer .btn-icon {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
}

.audit-trail-viewer .btn-icon:hover {
    background: #f8fafc;
    color: #1e293b;
}

.audit-trail-viewer .btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Dropdowns
   ============================================ */

.export-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    margin-top: 4px;
    padding: 6px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 100;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

/* ============================================
   Notification
   ============================================ */

.audit-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #1e293b;
    color: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.audit-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.audit-notification svg {
    width: 20px;
    height: 20px;
}

.audit-notification.success {
    background: #16a34a;
}

.audit-notification.error {
    background: #dc2626;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .audit-trail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .audit-trail-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search {
        max-width: none;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .entry-meta {
        flex-direction: column;
        gap: 6px;
    }

    .changes-table {
        font-size: 12px;
    }

    .changes-table th,
    .changes-table td {
        padding: 8px;
    }

    .detail-meta {
        flex-direction: column;
        gap: 8px;
    }

    .audit-trail-pagination {
        flex-direction: column;
        gap: 12px;
    }
}
