/*
 * Custom Stylesheet for the AI Writing Program
 * Author: Your Name
 * Date: August 2025
 * Description: Modern, clean, and professional design.
 */

:root {
    /* --- LIGHT THEME VARIABLES (Default) --- */
    --primary-color: #0056b3; /* Dark Blue */
    --primary-hover: #004494;
    --secondary-color: #6c757d; /* Gray */
    --accent-color: #20c997; /* Teal */
    
    --background-color: #f8f9fa; /* Light Gray */
    --card-background: #ffffff; /* White */
    --text-color: #343a40; /* Dark Gray */
    --text-muted: #6c757d;
    --heading-color: #212529; /* Black */
    --border-color: #e9ecef; /* Lighter Gray */
    
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-sub-bg: rgba(255, 255, 255, 0.92);
    --glass-dropdown-bg: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(0,0,0,0.05);
    
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;

    /* Reference checker colors */
    --cite-ok-bg: #eaf7ee;      
    --cite-miss-bg: #fdecea;    
    --ref-matched-bg: #eef5ff; 
    --ref-unmatched-bg: #fff7e6; 

    --sem-ok: #198754;      
    --sem-meh: #ffc107;     
    --sem-bad: #dc3545;     

    --spag-spell: #007bff; 
    --spag-gram: #fd7e14;  
    --spag-punct: #6f42c1; 
    --spag-style: #20c997; 
}

/* --- DARK THEME VARIABLES --- */
[data-bs-theme="dark"] {
    --primary-color: #3d8bfd; /* Brighter Blue for Dark Mode */
    --primary-hover: #0d6efd;
    --secondary-color: #adb5bd; /* Lighter Gray */
    --accent-color: #20c997; 

    --background-color: #121212; /* Deep Black/Gray */
    --card-background: #1e1e1e; /* Dark Card Surface */
    --text-color: #e0e0e0; /* Off-White */
    --text-muted: #b0b0b0;
    --heading-color: #ffffff; /* White */
    --border-color: #2d2d2d; /* Dark Gray Border */
    
    /* Dark Glass Variables */
    --glass-bg: rgba(30, 30, 30, 0.95);
    --glass-sub-bg: rgba(30, 30, 30, 0.92);
    --glass-dropdown-bg: rgba(30, 30, 30, 0.98);
    --glass-border: rgba(255,255,255,0.1);

    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);

    /* Adjust Feedback Colors for Dark Mode visibility */
    --cite-ok-bg: rgba(25, 135, 84, 0.2);      
    --cite-miss-bg: rgba(220, 53, 69, 0.2);     
    --ref-matched-bg: rgba(13, 110, 253, 0.15); 
    --ref-unmatched-bg: rgba(255, 193, 7, 0.15); 
}

/* --- MODERN UI: CUSTOM SCROLLBAR --- */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}
/* Chrome, Edge, and Safari */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(13, 110, 253, 0.5);
    border-radius: 20px;
    border: 3px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color);
}

/* General Styles */
body {
    font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-weight: 600;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Ensure Bootstrap's bg-light adapts to dark mode */
[data-bs-theme="dark"] .bg-light {
    background-color: #1a1d20 !important; /* Darker grey for sections */
    color: var(--text-color) !important;
}
[data-bs-theme="dark"] .bg-white {
    background-color: var(--card-background) !important;
    color: var(--text-color) !important;
}
[data-bs-theme="dark"] .text-muted {
    color: #b0b0b0 !important;
}

.card {
    background-color: var(--card-background); /* Use variable */
    border: 1px solid var(--border-color); /* Explicit border for dark mode definition */
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all var(--transition-speed) ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-accent {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.btn-accent:hover {
    background-color: #1a9a7a;
    border-color: #1a9a7a;
    color: #fff;
}

.form-control, .form-select {
    background-color: var(--card-background);
    color: var(--text-color);
    border-color: var(--border-color);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--card-background);
    color: var(--text-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    background-color: var(--card-background); /* Use variable */
}

.navbar-brand img {
    max-height: 40px;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-color); /* Ensure links adapt */
}
.navbar-nav .nav-link:hover {
    color: var(--primary-color);
}

.navbar-nav .nav-item .btn {
    margin-left: 0.5rem;
}

/* --- GLASSMORPHISM UTILITIES --- */
.navbar-glass {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.sub-navbar-glass {
    position: sticky;
    top: 76px;
    z-index: 1020;
    background: var(--glass-sub-bg) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.dropdown-menu-glass {
    background: var(--glass-dropdown-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--box-shadow) !important;
}
/* Fix dropdown links in dark mode */
.dropdown-item {
    color: var(--text-color);
}
.dropdown-item:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

/* Profile Picture in Navbar */
.profile-pic-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* Dashboard Cards */
.dashboard-card {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 8px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border-color);
}

.dashboard-card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.dashboard-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dashboard-card-text {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Flash Messages & Toasts */
.alert {
    border-radius: 8px;
}

.toast-container-custom {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 1060;
    width: 350px;
    pointer-events: none;
}

.alert-toast {
    pointer-events: auto;
    box-shadow: var(--box-shadow);
    border: none;
    border-left: 4px solid;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: var(--card-background) !important;
    color: var(--text-color) !important;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Smooth Page Fade In */
.main-content {
    animation: fadeInPage 0.6s ease-out;
}
@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar */
.sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 5rem; /* Adjust based on navbar height */
    height: calc(100vh - 5rem);
    overflow-y: auto;
    background-color: var(--card-background);
    border-right: 1px solid var(--border-color);
    padding: 1rem;
}

.sidebar .nav-link {
    color: var(--text-color);
    font-weight: 500;
    border-radius: 6px;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar .nav-link.active {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.sidebar .nav-link:hover {
    background-color: var(--background-color);
}

.sidebar-heading {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

/* Admin Dashboard */
.admin-sidebar {
    background-color: #212529; /* Keep admin sidebar dark */
    color: #f8f9fa;
}

.admin-sidebar .nav-link {
    color: #f8f9fa;
}

.admin-sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.admin-sidebar .nav-link:hover {
    background-color: #495057;
}

.admin-sidebar .sidebar-heading {
    color: #adb5bd;
}

/* Footer */
.footer {
    background-color: #212529 !important; /* Always dark footer */
    color: #f8f9fa;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer a {
    color: #f8f9fa;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* --- Team Management --- */
.team-member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: var(--card-background);
}

.team-member-info {
    display: flex;
    align-items: center;
}

.team-member-info img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
}

.team-member-name {
    font-weight: 600;
    margin: 0;
}

.team-member-email {
    color: var(--secondary-color);
    margin: 0;
}

.team-member-role {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

/* --- Rubric Builder --- */
#rubric-criteria {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    background-color: var(--card-background);
}

.criterion {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.criterion-header {
    background-color: var(--background-color);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.criterion-body {
    padding: 1.25rem;
}

.level {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

.level:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* --- Class/Student Management --- */
.student-card {
    position: relative;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-background);
    transition: all var(--transition-speed) ease;
}

.student-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--box-shadow);
}

.student-card-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* --- Smart Essay Marker & Annotation Tool --- */
.sem-highlight {
    cursor: pointer;
    border-radius: 3px;
    padding: 1px 0;
    transition: all 0.2s ease-in-out;
}

.sem-highlight-ok {
    background-color: var(--sem-ok-bg);
    border-bottom: 2px solid var(--sem-ok);
}
.sem-highlight-meh {
    background-color: var(--sem-meh-bg);
    border-bottom: 2px solid var(--sem-meh);
}
.sem-highlight-bad {
    background-color: var(--sem-bad-bg);
    border-bottom: 2px solid var(--sem-bad);
}

.sem-highlight:hover {
    filter: brightness(95%);
}

.sem-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* SPAG Highlighter */
.spag-highlight {
    border-radius: 3px;
    padding: 1px 0;
    border-bottom-width: 2px;
    border-bottom-style: solid;
    cursor: pointer;
}
.spag-highlight:hover {
    background-color: rgba(0,0,0,0.05);
}

.spag-spell { border-color: var(--spag-spell); }
.spag-gram  { border-color: var(--spag-gram); }
.spag-punct { border-color: var(--spag-punct); }
.spag-style { border-color: var(--spag-style); }

/* --- AI Detector --- */
.detector-bar-container {
    width: 100%;
    height: 30px;
    background-color: var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.detector-bar-human {
    height: 100%;
    background-color: #198754; /* Green */
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease-in-out;
}
.detector-bar-ai {
    height: 100%;
    background-color: #dc3545; /* Red */
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease-in-out;
}

/* --- Reference Checker --- */
.citation {
    border-radius: 3px;
    padding: 1px 2px;
}
.citation-ok {
    background-color: var(--cite-ok-bg);
}
.citation-missing {
    background-color: var(--cite-miss-bg);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: #dc3545; /* danger */
    cursor: help;
}
.reference {
    border-radius: 3px;
    padding: 1px 2px;
}
.reference-matched {
    background-color: var(--ref-matched-bg);
}
.reference-unmatched {
    background-color: var(--ref-unmatched-bg);
}
.legend .legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
    margin-right: .35rem;
}
.legend .legend-ok    { background: var(--cite-ok-bg); }
.legend .legend-miss { background: var(--cite-miss-bg); }

/* --- Legacy User Badge --- */
.legacy-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 1rem;
    color: #FFD700; 
    background-color: var(--card-background); /* Adapt to theme */
    border-radius: 50%;
    width: 1.4rem;
    height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: translate(30%, -30%);
    box-shadow: 0 0 0 2px var(--card-background);
}

/* Custom class for the legacy tooltip */
.legacy-tooltip {
    --bs-tooltip-bg: #000;
    --bs-tooltip-color: #FFD700;
}

/* --- Enterprise Logo --- */
.ent-logo { height: 28px; max-width: 160px; object-fit: contain; background: #fff; padding: 2px; border: 1px solid #e5e7eb; border-radius: .25rem; }

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px; 
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: none;
    z-index: 1000;
    opacity: 0.8;
    transition: all 0.3s;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
#back-to-top:hover {
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
}

/* --- Chat Popup --- */
#chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#chat-icon:hover {
    transform: scale(1.1);
}

#chat-popup {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    border-radius: 15px;
    background-color: var(--card-background);
    box-shadow: var(--box-shadow);
    z-index: 1001;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#chat-popup.show {
    display: flex;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h5 { margin: 0; }
#close-chat { background: none; border: none; color: white; font-size: 24px; }
.chat-body { flex-grow: 1; padding: 15px; overflow-y: auto; background-color: var(--background-color); }
.chat-footer { padding: 10px; border-top: 1px solid var(--border-color); display: flex; background-color: var(--card-background); }
#chat-input { flex-grow: 1; margin-right: 10px; background-color: var(--background-color); color: var(--text-color); border-color: var(--border-color); }
.user-message { text-align: right; }
.user-message .p-2 { background-color: var(--primary-color); color: white; }

/* --- Command Palette --- */
.cmd-palette-item {
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background 0.2s;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
}
.cmd-palette-item:hover, .cmd-palette-item.active {
    background-color: var(--background-color);
    color: var(--primary-color);
}
.cmd-shortcut-hint {
    font-size: 0.75rem;
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-color);
    color: var(--secondary-color);
    margin-left: auto;
}

/* --- Flowchart Modal Styles --- */
.modal-content {
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--background-color);
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--background-color);
}
.btn-close {
    filter: var(--bs-btn-close-white-filter); 
}
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.flow-option {
   cursor: pointer;
   transition: all 0.2s ease-in-out;
   border: 2px solid var(--border-color);
   background-color: var(--card-background);
}
.flow-option:hover {
   transform: translateY(-5px);
   border-color: var(--primary-color); 
   background-color: var(--background-color);
   box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;
}
[data-bs-theme="dark"] .flow-option:hover {
    background-color: #2d2d2d;
}
.flow-icon {
   font-size: 2.5rem;
   margin-bottom: 1rem;
}
.text-purple { color: #6f42c1; }

/* --- New User Highlight --- */
.btn-highlight-new-user {
    animation: glow-animation 1.5s infinite alternate;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color), 0 0 12px var(--primary-color);
}
@keyframes glow-animation {
    0% { box-shadow: 0 0 5px var(--primary-color); }
    100% { box-shadow: 0 0 15px var(--primary-color), 0 0 20px var(--primary-color); }
}


/* =========================================
--- LANDING PAGE STYLES ---
=========================================
*/

/* Hero Section */
.hero-section {
    background-color: var(--card-background);
    /* Original fallback */
    background-image: radial-gradient(circle at 15% 50%, rgba(230, 245, 255, 0.5), transparent 40%),
                      radial-gradient(circle at 85% 30%, rgba(230, 255, 240, 0.5), transparent 40%);
    border-bottom: 1px solid var(--border-color);
}
/* Dark Mode Adjustment for Hero Gradient opacity */
[data-bs-theme="dark"] .hero-section,
[data-bs-theme="dark"] .hero-animated-bg {
    background: linear-gradient(-45deg, #121212, #1a1a1a, #222, #121212) !important;
    background-size: 400% 400%;
}
[data-bs-theme="dark"] .hero-animated-bg::after {
    background: linear-gradient(to bottom, rgba(18,18,18,0) 0%, rgba(18,18,18,0.9) 80%, #121212 100%) !important;
}

/* --- HERO INPUT MOBILE FIX --- */
/* Makes text smaller on mobile to fit "placeholder", and larger on desktop */
.hero-email-input, .hero-section input[name="email"] {
    font-size: 1rem !important; /* 16px on mobile (fits text) */
    padding-left: 1rem !important;
}
@media (min-width: 768px) {
    .hero-email-input, .hero-section input[name="email"] {
        font-size: 1.25rem !important; /* Back to fs-5 size on desktop */
        padding-left: 1.5rem !important;
    }
}

.hero-section h1 {
    font-weight: 700;
    color: var(--heading-color);
}

/* Feature Highlight Section */
.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.feature-icon i {
    position: relative;
    top: 2px;
}

/* How It Works Section */
.step-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-background);
    transition: all 0.3s ease;
    height: 100%;
    padding-top: 3rem; /* Increased padding to prevent icon clipping */
}

.step-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.step-number {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 3px solid var(--card-background);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 2; /* Ensure above card content */
}

/* Time Saving Calculator */
.calculator-card {
    background-color: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.calculator-card .form-control-lg {
    font-size: 1.1rem;
    padding: 0.75rem 1.25rem;
}

#resultBox {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* All-in-One Platform Section */
.feature-card-alt {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-background);
    transition: all 0.3s ease;
}

.feature-card-alt:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 86, 179, 0.07);
}

/* Final CTA Section */
.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .hero-section h1, .display-4 { font-size: 2.5rem; }
    .hero-section .lead { font-size: 1.1rem; }
    .display-5 { font-size: 2.25rem; }
    .display-6 { font-size: 2rem; }
    .step-card { margin-bottom: 30px; }
    .py-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .py-lg-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .g-5 { --bs-gutter-y: 2rem; --bs-gutter-x: 1.5rem; }
    .feature-grid-section { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .account-tabs-container .tab-content { padding: 1.5rem; }
    .card-body.p-md-5 { padding: 1.5rem !important; }
}

/* Screenshot Gallery Styles */
.gallery-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-background);
    transition: all 0.3s ease;
    overflow: hidden;
}
.gallery-card a { display: block; }
.gallery-card img {
    transition: transform 0.3s ease;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: top;
}
.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 86, 179, 0.07);
}
.gallery-card:hover img { transform: scale(1.05); }
.gallery-caption {
    padding: 1rem;
    font-weight: 600;
    text-align: center;
    font-size: 0.95rem;
    background-color: var(--card-background);
}
.modal-body .img-fluid { width: 100%; }

/* Pricing Promise Box */
.pricing-promise-box {
    background-color: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

/* Footer Links Visibility Fix */
.footer.bg-light {
    background-color: #343a40 !important; /* Force dark background */
    color: #f8f9fa;
}

.footer .text-muted {
    color: #f8f9fa !important; /* Force links to be white */
}

.footer a.text-muted:hover {
    color: #ffffff !important; /* Brighter white on hover */
    text-decoration: underline;
}

/* Account Tabs */
.account-tabs-container .nav-tabs { border-bottom: 0; }
.account-tabs-container .nav-link {
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 0.5rem;
    transition: all 0.2s ease;
}
.account-tabs-container .nav-link.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}
.account-tabs-container .nav-link:hover {
    border-bottom-color: var(--primary-hover);
    color: var(--primary-hover);
}
.account-tabs-container .tab-content {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    padding: 2rem 2.5rem;
}
.account-tabs-container .tab-pane ul { list-style: none; padding-left: 0; }
.account-tabs-container .tab-pane li { padding-left: 0; margin-bottom: 0.5rem; font-size: 1.05rem; }

/* Visual Feature Grid */
.feature-grid-section .feature-image {
    border-radius: 0.5rem; /* 8px */
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
    border: 1px solid var(--border-color);
}

.feature-grid-section .feature-image:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
}

.feature-grid-section .feature-text-col ul {
    list-style: none;
    padding-left: 0;
}

.feature-grid-section .feature-text-col ul i {
    font-size: 1.25rem;
    position: relative;
    top: 2px;
}

/* Responsive ordering for alternating layout */
@media (min-width: 992px) {
    .feature-grid-section .order-lg-1 { order: 1 !important; }
    .feature-grid-section .order-lg-2 { order: 2 !important; }
    .feature-grid-section .feature-text-col.order-lg-2 { padding-left: 2rem; }
    .feature-grid-section .feature-text-col.order-lg-1 { padding-right: 2rem; }
}

/* =========================================
--- LANDING PAGE ANIMATIONS & EFFECTS ---
=========================================
*/

/* Scroll Progress Indicator */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #0d6efd, #20c997);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* -------------------------------------------------
   TYPEWRITER & HERO FIXES
   -------------------------------------------------
*/

/* 1. HERO HEADING CONTAINER FIX (PREVENTS JUMPING)
  We enforce a specific minimum height (240px) on the header container.
  Whether the text inside is 1 line or 2 lines, this container stays the same size,
  so the rest of the page (footer, content) never moves.
*/
.hero-heading {
    font-weight: 800;
    margin-bottom: 1rem;
    font-size: clamp(1.5rem, 5vw, 3.5rem); 
    line-height: 1.2;
    min-height: 240px; /* FIXED HEIGHT = NO JUMPING */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically center the text inside the fixed box */
    align-items: center; /* Horizontally center */
    text-align: center;
}

/* 2. WRAPPER FIX (PREVENTS SPILL)
   We allow the text to wrap naturally if it gets too long, instead of forcing nowrap.
*/
@media (min-width: 768px) {
    .hero-content-wrapper {
        display: block;        
        width: 100%;
        max-width: 1000px;     /* Optional constraint to keep it readable */
        white-space: normal !important; /* Allow wrap */
        text-align: center;   
    }
}

/* 3. TYPEWRITER TEXT STYLING */
.typewriter-text {
    border-right: 3px solid #20c997;
    padding-right: 5px;
    animation: blink-caret 0.75s step-end infinite;
    color: #20c997; 
    white-space: nowrap; /* Keep the specific word from breaking */
    display: inline-block; 
    vertical-align: bottom; 
    padding-bottom: 0.1em;
}

/* Invisible character to keep line-height stable */
.typewriter-text::before {
    content: "\00a0"; /* Non-breaking space */
    display: inline-block;
    width: 0;
    visibility: hidden;
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #20c997; }
}

/* -------------------------------------------------
   DEMO BUTTON REMOVAL (CSS FIX)
   -------------------------------------------------
*/
a[href="#demo-section"] {
    display: none !important;
}

/* Magnetic Button Class */
.magnetic-btn {
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Gradient Glowing Border (for Step Cards) */
.glow-card {
    position: relative;
    background: var(--card-background); 
    z-index: 1;
    overflow: visible; /* Changed from hidden to visible to allow icon overlap */
}
.glow-card::before {
    content: "";
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, #0d6efd, #20c997, #6f42c1, #0d6efd);
    background-size: 400% 400%;
    z-index: -1;
    border-radius: 14px;
    animation: glowingBorder 20s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.glow-card:hover::before {
    opacity: 1;
}
.glow-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--card-background);
    z-index: -1;
    border-radius: 12px;
}
@keyframes glowingBorder {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Glassmorphism Calculator & Blob Background */
.glass-section {
    position: relative;
    overflow: hidden;
}
.blob-bg {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translate(0, -50%);
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.4), rgba(32, 201, 151, 0.4));
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: blobFloat 10s infinite ease-in-out alternate;
    pointer-events: none;
}
@keyframes blobFloat {
    0% { transform: translate(0, -50%) scale(1); }
    100% { transform: translate(-50px, -60%) scale(1.1); }
}
.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    position: relative;
    z-index: 1;
}
[data-bs-theme="dark"] .glass-card {
    background: rgba(30, 30, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

/* Animated Hero Background with Bottom Fade */
.hero-animated-bg {
    background: linear-gradient(-45deg, #ffffff, #f0f9ff, #e6fffa, #f8f9fa);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    position: relative; 
    padding-bottom: 50px;
}
.hero-animated-bg::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 60%, #ffffff 100%);
    pointer-events: none; 
}
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.text-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 15px;
    display: inline-block; 
}

.hero-animate-up {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.hero-delay-1 { animation-delay: 0.1s; }
.hero-delay-2 { animation-delay: 0.2s; }
.hero-delay-3 { animation-delay: 0.3s; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-shimmer {
    position: relative;
    overflow: hidden;
}
.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

.float-icon {
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.ai-scan-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    display: block;
}
.ai-scan-line {
    position: absolute;
    top: -10%; left: 0; width: 100%; height: 5px;
    background: rgba(32, 201, 151, 0.8);
    box-shadow: 0 0 15px rgba(32, 201, 151, 0.9);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}
.ai-scan-container:hover .ai-scan-line {
    animation: scanImage 1.5s ease-in-out infinite;
}
.ai-scan-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(13, 110, 253, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}
.ai-scan-container:hover .ai-scan-overlay { opacity: 1; }
@keyframes scanImage {
    0% { top: -10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 110%; opacity: 0; }
}

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }

/* Infinite Marquee */
.marquee-container {
    background-color: var(--card-background);
    overflow: hidden;
    white-space: nowrap;
    padding: 1.5rem 0;
    position: relative;
}
.marquee-container::before, .marquee-container::after {
    content: "";
    position: absolute;
    top: 0; width: 100px; height: 100%;
    z-index: 2;
}
/* Marquee Fades must adapt to Dark Mode */
.marquee-container::before { left: 0; background: linear-gradient(to right, var(--background-color), transparent); }
.marquee-container::after { right: 0; background: linear-gradient(to left, var(--background-color), transparent); }

.marquee-content {
    display: inline-flex;
    animation: marquee 60s linear infinite;
}
.marquee-item {
    padding: 0 2.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1.1rem;
}
.marquee-item:hover { opacity: 1; color: var(--primary-color); }
.marquee-item i { font-size: 1.5rem; margin-right: 0.5rem; }
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* 3D Tilt Card */
.tilt-card {
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
    perspective: 1000px;
}
.tilt-card.is-resetting { transition: transform 0.5s ease-out; }

/* Explained Box for Dark Mode */
.explained-box {
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 3rem !important;
}
[data-bs-theme="dark"] .explained-box {
    background-color: #1e1e1e !important;
    border-color: #2d2d2d !important;
    color: #e0e0e0 !important;
}
[data-bs-theme="dark"] .explained-box p,
[data-bs-theme="dark"] .explained-box a {
    color: #e0e0e0 !important;
}

/* Fix Toasts Visibility in Dark Mode */
.alert-toast {
    background-color: var(--card-background) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
}
[data-bs-theme="dark"] .step-card,
[data-bs-theme="dark"] .card {
    background-color: var(--card-background) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color);
}