:root {
    /* Red Theme */
    --primary: #ef4444;       /* Red-500 */
    --primary-hover: #dc2626; /* Red-600 */
    --secondary: #9ca3af;     /* Gray-400 */
    --success: #22c55e;
    --danger: #b91c1c;        /* Red-700 */
    --warning: #eab308;
    --info: #06b6d4;
    
    /* Bootstrap Overrides */
    --bs-primary: #ef4444;
    --bs-primary-rgb: 239, 68, 68;
    --bs-danger: #b91c1c;
    --bs-danger-rgb: 185, 28, 28;
    
    --text-main: #fef2f2;     /* Red-50 */
    --text-muted: #fca5a5;    /* Red-300 (muted text) */
    
    --bg-main: #000000;       /* Black for Matrix */
    --glass-bg: rgba(20, 0, 0, 0.7); /* Dark Red tint */
    --glass-border: rgba(239, 68, 68, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    --radius: 4px; /* More angular/tech feel */
}

hr {
    border-color: var(--glass-border);
    opacity: 0.5;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Courier New', Courier, monospace; /* Matrix font */
    min-height: 100vh;
    overflow-x: hidden;
}

/* Matrix Canvas */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Lighter Animation for Dashboard/Profile */
.bg-light-animated {
    background: linear-gradient(-45deg, #1a0505, #2b0b0b, #1a0505, #450a0a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism Card */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius);
    color: var(--text-main);
}

.card-header {
    background: rgba(239, 68, 68, 0.05);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    font-weight: 700;
}

.card-body {
    padding: 1.5rem;
}

/* Navbar */
.navbar {
    background: rgba(20, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-brand {
    font-weight: 800;
    color: var(--primary) !important;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    position: relative;
    display: inline-block;
    font-size: 3rem !important; /* Increased size to 3rem */
    animation: flicker 8s infinite alternate;
}

.navbar-brand::before,
.navbar-brand::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    opacity: 0.4;
}

.navbar-brand::before {
    left: 1px;
    text-shadow: -1px 0 #ff4d4d;
    clip-path: inset(45% 0 44% 0);
    animation: glitch-anim-1 10s infinite linear alternate-reverse;
}

.navbar-brand::after {
    left: -1px;
    text-shadow: 1px 0 #991b1b;
    clip-path: inset(50% 0 30% 0);
    animation: glitch-anim-2 15s infinite linear alternate-reverse;
}

@keyframes flicker {
    0%, 19.9%, 20.1%, 23.9%, 24.1%, 25.9%, 26.1%, 54.9%, 55.1%, 100% {
        text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
        opacity: 1;
    }
    20%, 24%, 26%, 55% {
        text-shadow: none;
        opacity: 0.95;
    }
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(30% 0 60% 0); transform: translate(-2px, -1px); }
    10% { clip-path: inset(70% 0 10% 0); transform: translate(2px, 1px); }
    20% { clip-path: inset(10% 0 80% 0); transform: translate(-1px, -2px); }
    30% { clip-path: inset(40% 0 50% 0); transform: translate(1px, 1px); }
    40% { clip-path: inset(80% 0 10% 0); transform: translate(-2px, -1px); }
    50% { clip-path: inset(20% 0 70% 0); transform: translate(1px, 2px); }
    60% { clip-path: inset(50% 0 40% 0); transform: translate(-1px, -1px); }
    70% { clip-path: inset(0% 0 90% 0); transform: translate(1px, 2px); }
    80% { clip-path: inset(60% 0 30% 0); transform: translate(-2px, -1px); }
    90% { clip-path: inset(10% 0 80% 0); transform: translate(2px, 1px); }
    100% { clip-path: inset(30% 0 60% 0); transform: translate(-2px, -1px); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(60% 0 30% 0); transform: translate(2px, 1px); }
    10% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, -1px); }
    20% { clip-path: inset(80% 0 10% 0); transform: translate(1px, 2px); }
    30% { clip-path: inset(50% 0 40% 0); transform: translate(-1px, -1px); }
    40% { clip-path: inset(10% 0 80% 0); transform: translate(2px, 1px); }
    50% { clip-path: inset(70% 0 20% 0); transform: translate(-1px, -2px); }
    60% { clip-path: inset(40% 0 50% 0); transform: translate(2px, 1px); }
    70% { clip-path: inset(90% 0 0% 0); transform: translate(-1px, -2px); }
    80% { clip-path: inset(30% 0 60% 0); transform: translate(1px, 1px); }
    90% { clip-path: inset(80% 0 10% 0); transform: translate(-2px, -1px); }
    100% { clip-path: inset(60% 0 30% 0); transform: translate(2px, 1px); }
}

/* Modals */
.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    box-shadow: var(--glass-shadow);
}

.modal-header, .modal-footer {
    border-color: var(--glass-border);
}

.modal-title {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-close {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(-45deg);
}

/* Forms */
.form-control {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-family: 'Courier New', monospace;
}

.form-control:focus {
    background-color: rgba(0, 0, 0, 0.7);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
    color: var(--primary);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.input-group-text {
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-right: none;
    color: var(--primary);
}

.input-group .form-control {
    border-left: none;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border: 1px solid var(--primary);
    color: black;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--primary);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-danger {
    background-color: var(--danger);
    border: 1px solid var(--danger);
    color: white;
    font-weight: 700;
}

.btn-danger:hover {
    background-color: transparent;
    color: var(--danger);
    box-shadow: 0 0 15px rgba(185, 28, 28, 0.4);
}

.btn-outline-danger {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.btn-outline-danger:hover {
    background-color: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    border-color: var(--glass-border);
}

.table thead th {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid var(--glass-border);
}

.table-hover tbody tr:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* List Groups */
.list-group-item {
    background-color: transparent;
    color: var(--text-main);
    border-color: var(--glass-border);
}

.list-group-item:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--glass-border);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    background: transparent;
    transition: all 0.3s;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background: transparent;
    border-bottom: 2px solid var(--primary);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 600;
    border-radius: 2px;
}

/* Utilities */
.text-muted {
    color: var(--text-muted) !important;
}

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

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Scanline Overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.03),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.03)
    );
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.3;
}

/* Matrix Toast */
.matrix-toast {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(15px);
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

@media (min-width: 992px) {
    .matrix-toast {
        min-width: 400px;
    }
    .matrix-toast .toast-body {
        font-size: 1.1rem;
        padding: 1.25rem;
    }
}

.matrix-toast .toast-header {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--primary) !important;
    border-bottom: 1px solid var(--glass-border);
}

.matrix-toast .btn-close {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(-45deg);
}

@keyframes pulse-red {
    0% { opacity: 0.4; }
    50% { opacity: 1; text-shadow: 0 0 10px var(--primary); }
    100% { opacity: 0.4; }
}

.animate-pulse-red {
    animation: pulse-red 2s infinite;
}

/* Command Palette */
.command-palette {
    background: rgba(10, 0, 0, 0.95) !important;
    border: 1px solid var(--primary) !important;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4) !important;
    border-radius: 4px;
}

.command-input {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid var(--glass-border) !important;
    color: var(--primary) !important;
    font-size: 1.2rem;
    padding: 1rem;
    outline: none;
}

.command-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.command-option:hover, .command-option.active {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--primary);
    color: var(--primary);
}

.command-shortcut {
    font-size: 0.7rem;
    opacity: 0.5;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Security Checklist */
.checklist-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 12px;
    font-size: 0.8rem;
}

.checklist-done {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.checklist-todo {
    background: rgba(239, 68, 68, 0.1);
    color: var(--primary);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Identicon */
.identicon {
    image-rendering: pixelated;
    border: 1px solid var(--glass-border);
    padding: 2px;
    background: rgba(0,0,0,0.3);
}

/* Error Glitch */
.glitch-text {
    position: relative;
    animation: glitch-text-anim 3s infinite linear alternate-reverse;
}

@keyframes glitch-text-anim {
    0% { transform: skew(0deg); }
    20% { transform: skew(0deg); }
    21% { transform: skew(10deg); filter: blur(1px); }
    22% { transform: skew(-10deg); }
    23% { transform: skew(0deg); filter: blur(0); }
    100% { transform: skew(0deg); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Disable Animations */
.no-animations * {
    animation: none !important;
    transition: none !important;
}
.no-animations .navbar-brand::before,
.no-animations .navbar-brand::after {
    display: none !important;
}
.no-animations #matrix-bg {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Modern Dialog System
   Replaces native confirm/alert/prompt
   ============================================ */

/* Overlay */
.rauth-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 1rem;
}

.rauth-dialog-overlay.visible {
    opacity: 1;
}

/* Dialog Container */
.rauth-dialog {
    background: rgba(15, 2, 2, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow:
        0 0 40px rgba(239, 68, 68, 0.15),
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    max-width: 440px;
    width: 100%;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.rauth-dialog-overlay.visible .rauth-dialog {
    transform: scale(1) translateY(0);
}

/* Dialog Icon Area */
.rauth-dialog-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 0.5rem;
}

.rauth-dialog-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    animation: dialog-icon-pulse 2s ease-in-out infinite;
}

/* Danger variant (default) */
.rauth-dialog-icon-circle.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--primary);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

/* Warning variant */
.rauth-dialog-icon-circle.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.15);
}

/* Info variant */
.rauth-dialog-icon-circle.info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info);
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

/* Error/alert variant */
.rauth-dialog-icon-circle.error {
    background: rgba(185, 28, 28, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(185, 28, 28, 0.4);
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.2);
}

@keyframes dialog-icon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Dialog Body */
.rauth-dialog-body {
    padding: 1rem 2rem 0.5rem;
    text-align: center;
}

.rauth-dialog-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rauth-dialog-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    opacity: 0.8;
}

/* Prompt Input */
.rauth-dialog-input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rauth-dialog-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.rauth-dialog-input::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

/* Dialog Actions */
.rauth-dialog-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem 2rem 2rem;
}

.rauth-dialog-btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid;
}

.rauth-dialog-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.rauth-dialog-btn-cancel {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-muted);
}

.rauth-dialog-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
    color: var(--text-main);
}

.rauth-dialog-btn-confirm {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
}

.rauth-dialog-btn-confirm:hover {
    background: transparent;
    color: var(--primary);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.rauth-dialog-btn-confirm.warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

.rauth-dialog-btn-confirm.warning:hover {
    background: transparent;
    color: var(--warning);
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
}

.rauth-dialog-btn-confirm.error {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.rauth-dialog-btn-confirm.error:hover {
    background: transparent;
    color: #ff6b6b;
    box-shadow: 0 0 15px rgba(185, 28, 28, 0.4);
}

/* Alert variant (single OK button, centered) */
.rauth-dialog-actions.alert-only {
    justify-content: center;
}

.rauth-dialog-actions.alert-only .rauth-dialog-btn {
    flex: 0 1 auto;
    min-width: 140px;
}

/* Keyboard hint */
.rauth-dialog-hint {
    padding: 0 2rem 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    opacity: 0.35;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rauth-dialog-hint kbd {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 3px;
    padding: 1px 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    color: var(--text-muted);
}
