/* ==========================================================================
   ThrallScribe Premium Glassmorphic Dark Dashboard Stylesheet
   ========================================================================== */

:root {
    --bg-base: #060913;
    --sidebar-bg: rgba(13, 20, 38, 0.45);
    --card-bg: rgba(20, 30, 54, 0.45);
    --border-color: rgba(56, 189, 248, 0.15);
    --border-hover: rgba(56, 189, 248, 0.3);
    
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --primary-glow: rgba(56, 189, 248, 0.25);
    
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.25);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background animated glow matrix */
.matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, rgba(244, 63, 94, 0.03) 0%, transparent 50%);
}

/* Core Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Navigation */
.glass-sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 10;
}

.brand-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 45px;
}

.brand-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    padding: 14px 18px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--border-color);
    box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.05);
}

/* System Status indicator */
.system-status {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.pulse-dot.status-connected {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.pulse-dot.status-connected::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

.pulse-dot.status-disconnected {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* Main Viewport */
.main-viewport {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 40px;
}

.dashboard-tab {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.hidden {
    display: none !important;
}

/* Page Headers */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 20px;
}

.view-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.view-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* General Glass Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transition: border-color 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-hover);
}

/* Filters & Search Control Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 24px;
}

.search-box {
    position: relative;
    width: 320px;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-box input {
    width: 100%;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px 12px 42px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.select-wrapper select {
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 36px 12px 36px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

/* General Buttons */
.btn {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0ea5e9);
    color: #0b0f19;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

/* CRUD Table Styles */
.table-container {
    overflow-x: auto;
    padding: 0;
}

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

.crud-table th, 
.crud-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.crud-table th {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.01);
}

.crud-table tbody tr {
    transition: background 0.2s ease;
}

.crud-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.badge-id {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-party {
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(168, 85, 247, 0.12);
    color: #d8b4fe;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.transcript-text-cell {
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: #e2e8f0;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-edit {
    color: var(--primary);
}

.btn-edit:hover {
    background: rgba(56, 189, 248, 0.08);
}

.btn-delete {
    color: var(--danger);
    margin-left: 10px;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* Audit Session Event Badges */
.badge-event {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge-event-success {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-event-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-event-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fde047;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-event-info {
    background: rgba(56, 189, 248, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.empty-state-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 60px;
    color: var(--text-muted);
}

/* Modals (Overlay & Box) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    width: 500px;
    max-width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-overlay:not(.hidden) .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 20px;
    margin-top: 20px;
}

/* Toast Notifications */
.toast-popup {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-popup.toast-show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-color: var(--success); color: #6ee7b7; }
.toast-error { border-color: var(--danger); color: #fca5a5; }
.toast-warning { border-color: var(--warning); color: #fde047; }