:root {
    /* Phase 1: Global Styles & Theme Definition */
    /* Primary Colors */
    --primary-green: #00FF41;   /* Matrix Green */
    --bg-dark: #0a0a0a;         /* Deep Black Surface */
    --accent-blue: #00d1ff;     /* Cyber Blue */
    --alert-red: #ff0055;       /* Alert Red */
    
    /* Component Backgrounds */
    --card-bg: rgba(0, 20, 0, 0.6);
    
    /* Effects */
    --glow: 0 0 10px rgba(0, 255, 65, 0.2);
    --glow-strong: 0 0 15px rgba(0, 255, 65, 0.4);
    --border-subtle: rgba(0, 255, 65, 0.3);
    
    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --font-sans: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif; /* For Readability Mode */
}

/* Phase 1 & 3: Body & Layout */
body.hacking-theme {
    background-color: var(--bg-dark);
    /* Action 2 (Grid Background) */
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px), 
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px); 
    background-size: 30px 30px;
    background-attachment: fixed;
    
    color: var(--primary-green);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* READABILITY MODE */
body.readability-mode {
    --primary-green: #2c3e50; /* Dark Blue-Grey for text */
    --bg-dark: #f8f9fa;       /* Light Grey Background */
    --card-bg: #ffffff;       /* White Cards */
    --accent-blue: #2980b9;
    --alert-red: #c0392b;
    --glow: none;
    
    background-color: var(--bg-dark);
    background-image: none;
    color: #333;
    font-family: var(--font-sans);
}

body.readability-mode::before {
    display: none; /* Hide Scanline */
}

body.readability-mode .card {
    background: #fff !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    clip-path: none; /* Remove clipped corners */
    backdrop-filter: none;
}

body.readability-mode .card::before,
body.readability-mode .card::after {
    display: none; /* Hide scanlines and micro-data on cards */
}

body.readability-mode .navbar {
    background-color: #fff;
    border-bottom: 1px solid #ddd !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

body.readability-mode .navbar-brand {
    color: #2c3e50 !important;
    text-shadow: none;
}

body.readability-mode .glitch-text {
    text-shadow: none;
    animation: none;
}

body.readability-mode .nav-link {
    color: #555 !important;
    font-family: var(--font-sans);
    font-weight: 500;
}

body.readability-mode .nav-link.active,
body.readability-mode .nav-link:hover {
    color: #2980b9 !important;
    background: transparent;
    border-bottom: 2px solid #2980b9;
    text-shadow: none;
}

body.readability-mode .nav-link::before,
body.readability-mode .nav-link::after {
    display: none;
}

body.readability-mode .text-success { color: #27ae60 !important; }
body.readability-mode .text-muted { color: #7f8c8d !important; }
body.readability-mode .border-success { border-color: #ddd !important; }

body.readability-mode .btn-outline-success {
    color: #27ae60;
    border-color: #27ae60;
}

body.readability-mode .btn-outline-success:hover {
    background-color: #27ae60;
    color: #fff;
}

body.readability-mode .markdown-body {
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2c3e50;
}

/* Phase 1: Action 2 - CRT Scanline Overlay */
body::before { 
    content: " "; 
    display: block; 
    position: fixed; 
    top: 0; left: 0; bottom: 0; right: 0; 
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02)); 
    background-size: 100% 4px, 3px 100%; 
    z-index: 9999; 
    pointer-events: none; 
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-green);
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Phase 3: Action 1 (The Header) - Glitch Effect */
h1.glitch-text {
    position: relative;
    display: inline-block;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5); /* Glow Effect */
}

h1.glitch-text:hover {
    text-shadow: 2px 0 var(--alert-red), -2px 0 var(--accent-blue);
    animation: glitch-anim 0.2s infinite;
    cursor: default;
}

@keyframes glitch-anim { 
    0% { transform: translate(0); } 
    20% { transform: translate(-2px, 2px); } 
    40% { transform: translate(-2px, -2px); } 
    60% { transform: translate(2px, 2px); } 
    80% { transform: translate(2px, -2px); } 
    100% { transform: translate(0); } 
}

a {
    color: var(--primary-green);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--accent-blue);
    text-shadow: 0 0 8px rgba(0, 209, 255, 0.5);
}

/* Phase 2: Container & Component Refactoring (Tactical UI) */
.card {
    background: var(--card-bg) !important;
    border: 1px solid var(--primary-green); /* Action 2: 1px border */
    border-radius: 0 !important; /* Remove generic radius */
    
    /* Action 1: Clipped Corners */
    clip-path: polygon(
        0% 15px, 
        15px 0%, 
        100% 0%, 
        100% 85%, 
        calc(100% - 15px) 100%, 
        0% 100%
    );
    
    /* Action 2: Glow */
    box-shadow: var(--glow);
    
    /* Action 3: Glassmorphism */
    backdrop-filter: blur(8px);
    
    margin-bottom: 2rem;
    position: relative;
    overflow: visible; 
    padding: 0; /* Reset padding, let body handle it */
}

/* Scanning Effect */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 65, 0.5);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.8);
    animation: scan-vertical 4s ease-in-out infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 10;
}

@keyframes scan-vertical {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { top: 100%; opacity: 0; }
}

.card-header {
    background: rgba(0, 255, 65, 0.1) !important;
    border-bottom: 1px solid var(--primary-green);
    color: var(--primary-green) !important;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1rem 1.5rem;
    letter-spacing: 1px;
}

.card-body {
    padding: 1.5rem;
    color: #e0e0e0;
}

/* Phase 4: Action 2 - Micro-data Labels */
.card::after {
    content: "SYS_STATUS: OPTIMAL";
    position: absolute;
    top: 5px;
    right: 25px; 
    font-size: 9px;
    color: var(--primary-green);
    opacity: 0.6;
    letter-spacing: 1px;
    pointer-events: none;
    font-family: var(--font-mono);
}

/* Specific Micro-data */
.card-data-1::after { content: "SEC_LVL: 3 // LATENCY: 22ms"; }
.card-data-2::after { content: "AUTH_STATUS: OK // ENCRYPTED"; }
.card-data-3::after { content: "NODE: ACTIVE // PING: 4ms"; }


/* Navbar Styling */
.navbar {
    background-color: rgba(10, 15, 10, 0.95);
    border-bottom: 1px solid var(--primary-green) !important;
    box-shadow: 0 4px 20px rgba(0, 255, 65, 0.1);
    padding: 1rem 0;
}

.navbar-brand {
    color: var(--primary-green) !important;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

/* Phase 3: Action 3 - Interactive Navigation */
.navbar-nav .nav-link {
    color: var(--primary-green) !important;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
    color: var(--accent-blue) !important;
    text-shadow: 0 0 5px var(--accent-blue);
}

.navbar-nav .nav-link.active {
    background: rgba(0, 255, 65, 0.1);
    border-bottom: 2px solid var(--primary-green);
}

.navbar-nav .nav-link::before {
    content: "< ";
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: inline-block;
    transform: translateX(10px);
}

.navbar-nav .nav-link::after {
    content: " >";
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: inline-block;
    transform: translateX(-10px);
}

.navbar-nav .nav-link:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.navbar-nav .nav-link:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* Tags & Badges */
.badge-tech {
    font-size: 0.7rem;
    padding: 2px 6px;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    margin-right: 5px;
    text-transform: uppercase;
    background: rgba(0, 20, 0, 0.5);
}

.badge-tech.reverse { border-color: var(--accent-blue); color: var(--accent-blue); }
.badge-tech.crypto { border-color: #ff9900; color: #ff9900; }
.badge-tech.pwn { border-color: var(--alert-red); color: var(--alert-red); }

/* Dimmed Text */
.text-dim {
    color: rgba(0, 255, 65, 0.5);
    font-size: 0.85rem;
}

/* Full Width Buttons */
.btn-block-bottom {
    display: block;
    width: 100%;
    text-align: center;
    border-top: 1px solid var(--primary-green);
    margin-top: 1rem;
    padding-top: 0.5rem;
    color: var(--primary-green);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.btn-block-bottom:hover {
    background: rgba(0, 255, 65, 0.1);
    color: var(--accent-blue);
}

/* Bootstrap Overrides */
.text-success { color: var(--primary-green) !important; }
.text-muted { color: rgba(0, 255, 65, 0.6) !important; }
.bg-black { background-color: transparent !important; } /* Let card bg handle it */
.border-success { border-color: var(--primary-green) !important; }

/* Buttons */
.btn-outline-success {
    color: var(--primary-green);
    border: 1px solid var(--primary-green);
    background: transparent;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-outline-success:hover {
    background: rgba(0, 255, 65, 0.1);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 209, 255, 0.3);
}

/* Form Elements */
.form-control {
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    border-radius: 0;
    font-family: var(--font-mono);
}

.form-control:focus {
    background-color: rgba(0, 0, 0, 0.8);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(0, 209, 255, 0.2);
}

.form-control::placeholder {
    color: rgba(0, 255, 65, 0.3);
}

/* Phase 4: Action 3 - Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Footer Typing Effect (Base Styles) */
.typing-effect {
    border-right: 2px solid var(--primary-green);
    white-space: nowrap;
    overflow: hidden;
    animation: blink-caret 0.75s step-end infinite;
    display: inline-block;
    max-width: 100%;
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-green) }
}
