:root {
    --bg-color: #0d0e12;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent-color: #d4af37;
    --accent-glow: rgba(212, 175, 55, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #8a8a8a;
    --success: #10b981;
    --error: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.1);
}

::selection {
    background: var(--accent-glow);
    color: white;
}

:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
}

.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, #3a2e0a 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, #52400a 0%, transparent 40%);
    filter: blur(80px);
    z-index: -1;
}

.container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    width: 95%;
    max-width: 1400px;
    padding: 2rem 0;
    align-items: start;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.sidebar {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 1.5rem;
    backdrop-filter: blur(15px);
    height: calc(100vh - 4rem);
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--accent-color);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.nav-item:hover {
    color: var(--accent-color);
    background: rgba(214, 175, 55, 0.05);
    border-color: rgba(214, 175, 55, 0.2);
    box-shadow: 0 4px 12px rgba(214, 175, 55, 0.05);
}

.nav-item.active {
    color: var(--accent-color);
    background: rgba(214, 175, 55, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

.nav-icon {
    font-size: 1.1rem;
}

.page-header-title h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-header-title .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
    margin-top: 0.25rem;
}

.pulse {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0 var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(0, 0, 0, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.stat-card .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 600;
}

.stat-total .value { color: #ffffff; }
.stat-total .label { color: rgba(255, 255, 255, 0.6); }

.stat-volume .value { color: var(--accent-color); }
.stat-volume .label { color: var(--accent-color); opacity: 0.8; }

.stat-success .value { color: var(--success); }
.stat-success .label { color: var(--success); opacity: 0.8; }

.stat-failed .value { color: var(--error); }
.stat-failed .label { color: var(--error); opacity: 0.8; }

.transaction-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px var(--accent-glow);
}

.header-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.mti { color: var(--accent-color); font-weight: 600; }
.code-success { color: var(--success); font-weight: 600; }
.code-error { color: var(--error); font-weight: 600; }
.code-warn { color: #f59e0b; font-weight: 600; }
.timestamp { color: var(--text-secondary); font-size: 0.8rem; }

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
    font-size: 0.9rem;
}

/* Filter Section Styles */
.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.filter-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

.filter-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        width: 90%;
    }
    
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1.2rem 1.5rem;
        gap: 1.5rem;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-item {
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats {
        width: 100%;
        justify-content: flex-start;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

#page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pagination-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.site-footer strong {
    color: var(--accent-color);
    font-weight: 600;
}

/* Clickable RRN Link */
.rrn-link {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 6px;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.4);
}

.rrn-link:hover {
    background: rgba(212, 175, 55, 0.12);
    border-bottom-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
    text-shadow: 0 0 12px var(--accent-glow);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.modal-container {
    background: linear-gradient(145deg, rgba(22, 24, 30, 0.97), rgba(13, 14, 18, 0.98));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 92%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 40px 80px -20px rgba(0, 0, 0, 0.6),
        0 0 60px -10px rgba(212, 175, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(30px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.8rem 2rem 1.2rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.modal-subtitle {
    display: block;
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-top: 0.3rem;
    font-weight: 500;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 1.2rem 2rem 2rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Detail Row */
.detail-row {
    display: flex;
    flex-direction: column;
    padding: 0.9rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease;
}

.detail-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.detail-row.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.detail-value {
    font-size: 0.92rem;
    color: var(--text-primary);
    word-break: break-all;
    font-weight: 500;
}

.detail-value.accent {
    color: var(--accent-color);
    font-weight: 700;
}

.detail-value.success {
    color: var(--success);
    font-weight: 600;
}

.detail-value.error {
    color: var(--error);
    font-weight: 600;
}

.detail-value.muted {
    color: var(--text-secondary);
    font-style: italic;
}

/* Status Badge in Modal */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-badge.warn {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

@media (max-width: 600px) {
    .modal-container {
        width: 96%;
        border-radius: 18px;
    }

    .modal-header {
        padding: 1.4rem 1.4rem 1rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
        padding: 1rem 1.4rem 1.4rem;
    }
}

/* Toast Notification Styles */
.error-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
    color: #ffffff;
    padding: 0.85rem 1.4rem;
    border-radius: 14px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.error-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
