/* ── Modal Overlay ──────────────────────────────────────────── */
.audit-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: auditFadeIn 0.2s ease;
}

@keyframes auditFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Syncfusion Dialog Overrides ────────────────────────────── */
.audit-sf-dialog .e-dlg-header-content {
    padding: 0 !important;
    border-bottom: none !important;
}

.audit-sf-dialog .e-dlg-content {
    padding: 0 !important;
    background: var(--bg-secondary) !important;
}

.audit-modal-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    width: min(94vw, 1200px);
    max-height: 92vh;
    animation: auditSlideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

@keyframes auditSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── GCN-STYLE Header ────────────────────────────────────────── */
.audit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--bg-secondary);
}

.audit-header-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.audit-header-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.audit-header-subtitle .record-ref {
    color: #2563eb;
    font-weight: 700;
}

/* ── Filter Row (Tab Style) ──────────────────────────────────── */
.audit-filter-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.6rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.audit-filter-item {
    padding: 0.5rem 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.audit-filter-item:hover {
    color: var(--primary-color);
}

.audit-filter-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ── Premium Tabs ───────────────────────────────────────────── */
.premium-tabs-wrapper {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.premium-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    border-radius: 7px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.premium-tab:hover { background: #e2e8f0; color: #1e293b; }
.premium-tab.active { 
    background: white; 
    color: #2563eb; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); 
}

/* ── Body ────────────────────────────────────────────────────── */
.audit-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
}

/* ── Footer ──────────────────────────────────────────────────── */
.audit-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.btn-gcn-close {
    background: var(--primary-color);
    color: white !important;
    font-weight: 700;
    padding: 0.6rem 2.5rem;
    border-radius: 6px;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-gcn-close:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.3);
}

/* ── Card Containers ─────────────────────────────────────────── */
.audit-card {
    background: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.audit-card-header {
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audit-card-body {
    padding: 0;
}

/* ── Premium Cards ──────────────────────────────────────────── */
.premium-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.p-card-header {
    background: #f8fafc;
    padding: 10px 15px;
    font-weight: 800;
    font-size: 0.72rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid #f1f5f9;
}

.branch-summary-box {
    font-size: 0.75rem;
    background: white;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    font-weight: 600;
}

/* ── Grid Table ─────────────────────────────────────────────── */
.audit-log-table thead th {
    background: var(--bg-primary);
    color: var(--text-tertiary);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-top: none;
}

.audit-log-table tbody tr td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.audit-row-selected {
    background: rgba(37, 99, 235, 0.05) !important;
}

/* ── SfGrid Customization ────────────────────────────────────── */
.e-grid {
    border: none !important;
    font-family: inherit !important;
}

.e-grid .e-headercell {
    background-color: #f8fafc !important;
    color: #64748b !important;
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.e-grid .e-rowcell {
    font-size: 0.75rem !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* ── Detail Panel Refinements ────────────────────────────────── */
.audit-compare-table thead th {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    font-weight: 700;
    font-size: .75rem;
    text-transform: uppercase;
    padding: 0.6rem 1rem;
}

.audit-field-name {
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 600;
}

/* ── Modern Badges (GCN Style) ───────────────────────────────── */
.badge-gcn {
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-gcn-insert { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-gcn-update { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-gcn-delete { background: #fce7f3; color: #9b174d; border: 1px solid #fbcfe8; }

.badge-approved {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

/* ── Premium Status Badges ───────────────────────────────────── */
.badge-premium-status {
    padding: 4px 12px;
    border-radius: 60px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.status-pending { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-delivered { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.status-approved { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.status-training { background: #fce7f3; color: #9b174d; border: 1px solid #fbcfe8; }
.status-other { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* ── Dark Mode Support ──────────────────────────────────────── */
[data-theme="dark"] .audit-modal-container {
    background: var(--bg-primary);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-color: var(--border-color);
}

[data-theme="dark"] .audit-modal-header,
[data-theme="dark"] .audit-modal-footer,
[data-theme="dark"] .audit-filter-bar {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .audit-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .audit-log-table thead th {
    background: var(--bg-primary);
}

[data-theme="dark"] .badge-gcn-insert { background: rgba(16, 185, 129, 0.15); color: #34d399; }
[data-theme="dark"] .badge-gcn-update { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
[data-theme="dark"] .badge-gcn-delete { background: rgba(239, 68, 68, 0.15); color: #f87171; }
[data-theme="dark"] .badge-approved { background: rgba(37, 99, 235, 0.15); color: #60a5fa; border-color: rgba(37, 99, 235, 0.3); }
