html {
    box-sizing: border-box;
}
*, *::before, *::after {
    box-sizing: inherit;
}
body {
    margin: 0;
    padding: 0;
}

.shadow-ios-button {
    box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
}

.shadow-ios-button:hover {
    box-shadow: inset 0px 2px 3px rgba(0, 0, 0, 0.2);
}
body {
    background-color: var(--page-bg-color, #f9fafb);
    color: var(--default-text-color, #000000);
}
.hero-bg {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.9) 0%, rgba(15, 23, 42, 0.9) 100%);
    background-image: url('../images/avctopbanner.png'); /* Adjusted path */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Ensure the background is initially hidden until loaded */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Class to show background after loading */
.hero-bg.loaded {
    opacity: 1;
}

/* Ensure the hero section takes full viewport height */
#home {
    min-height: 100vh;
    height: auto;
    position: relative;
    top: 0px; /* Move home section up by 20px */
    z-index: 0;
}

/* Ensure background covers entire viewport */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
}

/* Ensure the content within hero section is properly positioned */
#home .container {
    position: relative;
    z-index: 2;
    /* Removed fixed height and flex centering to allow natural flow like bannertest.php */
    /* height: 100%; */
    /* display: flex; */
    /* flex-direction: column; */
    /* justify-content: center; */
}

/* Ensure the loader is properly positioned */
#hero-background-loader {
    z-index: 1;
}
/* Home section title color override */
#home h1 {
    color: #006DBF !important;
}
.formula-card {
    transition: transform 0.3s ease;
    border: 1px solid transparent;
}
.formula-card:hover {
    transform: translateY(-5px);
    animation: border-glow-green 2s infinite;
    border-color: #b2f2bb !important;
}
.login-form {
    display: none;
}
.active-login {
    display: block;
}

/* Professional "glass" image style used on pro websites */
.pro-glass-img {
    display: inline-block;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.35);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
    box-shadow:
        0 10px 30px rgba(2,6,23,0.18),
        0 2px 6px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.04);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    backdrop-filter: blur(6px) saturate(120%);
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s;
    transform: translateZ(0);
}

.pro-glass-img:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow:
        0 18px 40px rgba(2,6,23,0.22),
        0 6px 12px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Professional "glass" card style (applies the glass effect to the whole card) */
.pro-glass-card {
    position: relative;
    border-radius: 0.75rem; /* matches existing rounded-lg */
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15); /* More visible background */
    border: 1px solid rgba(255,255,255,0.3); /* More visible border */
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    backdrop-filter: blur(12px) saturate(150%);
    box-shadow:
        0 12px 30px rgba(2,6,23,0.2),
        0 3px 8px rgba(0,0,0,0.1);
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s;
}

.pro-glass-card:hover {
    transform: translateY(-5px);
    animation: border-glow-green 2s infinite;
    border-color: #b2f2bb !important;
}

/* Disable popup effect for hero texts inside #home section, but keep border glow */
#home .pro-glass-card:hover {
    transform: none;
}

/* Disable popup effect for cassandra-ai.php page card, but keep border glow */
.page-cassandra .pro-glass-card:hover {
    transform: none;
}

/* Subtle overlay accent inside the card for depth */
.pro-glass-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
    mix-blend-mode: overlay;
}

/* Contact form inputs: hover/focus match hamburger pastel-green */
#card-send-message input:hover,
#card-send-message textarea:hover,
#card-send-message input:focus,
#card-send-message textarea:focus {
    border-color: #b2f2bb !important;
    box-shadow: 0 0 0 4px rgba(178,242,187,0.15) !important;
    outline: none !important;
}

/* Also ensure the input placeholder/label contrast remains readable on focus */
#card-send-message input:focus::placeholder,
#card-send-message textarea:focus::placeholder {
    color: #9aa199 !important;
    opacity: 1;
}

/* Contact email link style: default black, hover gold, no underline */
.contact-mail-link {
    color: #000000 !important;
    text-decoration: none !important;
    transition: color .12s ease;
}
.contact-mail-link:hover {
    color: #f59e0b !important;
    text-decoration: none !important;
}

/* Thumbs-up hover animation for contact email */
.contact-mail-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.contact-mail-thumb {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px) scale(0.85);
    transition: opacity .22s ease, transform .22s ease;
    font-size: 1rem;
    pointer-events: none;
    will-change: transform, opacity;
    color: #16a34a; /* green tint for thumbs */
}
.contact-mail-wrap:hover .contact-mail-thumb {
    opacity: 1;
    transform: translateY(0) scale(1);
}
/* When clicked, fade-out animation */
.contact-mail-wrap.clicked .contact-mail-thumb {
    opacity: 0;
    transform: translateY(-12px) scale(0.7);
    transition: opacity .4s ease, transform .4s ease;
}

/* Send button styled like mobile menu buttons */
.send-menu-btn {
    display: flex; /* Changed to flex */
    align-items: center; /* Vertically center content */
    justify-content: center; /* Horizontally center content */
    height: 40px; /* Set button height to 40px */
    /* width: 100%; Removed to allow width:auto from inline style or other classes */
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: var(--btn-bg-color, linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%));
    border: 1px solid var(--btn-border-color, rgba(0,0,0,0.14));
    color: var(--btn-text-color, #1e40af);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 12px var(--btn-shadow-color, rgba(0,0,0,0.18)), inset 0 2px 0 rgba(255,255,255,0.6); /* Mobile menu button shadow */
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.send-menu-btn:hover {
    background: var(--btn-hover-bg, linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%));
    animation: border-glow-gold-green 2s infinite;
    transform: translateY(-1px);
    color: var(--btn-hover-text-color, #0b1220);
    border-color: var(--btn-hover-border-color, #f59e0b);
}
.send-menu-btn:active {
    transform: translateY(0);
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}
.send-menu-btn:focus {
    outline: 3px solid rgba(178,242,187,0.28);
    outline-offset: 2px;
}

/* New class for buttons that should look like menu items */
.menu-item-button {
    display: flex; /* Changed to flex */
    align-items: center; /* Vertically center content */
    justify-content: center; /* Horizontally center content */
    height: 40px; /* Set button height to 40px */
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%);
    border: 1px solid rgba(0,0,0,0.08);
    color: #006DBF; /* Default text color */
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6);
    transition: all 0.2s ease-in-out;
    text-align: center;
    text-decoration: none;
}

.menu-item-button:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%);
    animation: border-glow-gold-green 2s infinite;
    transform: translateY(-1px);
    color: #0b1220; /* Changed to dark text on hover */
    border-color: #f59e0b;
}

.menu-item-button:active {
    transform: translateY(0);
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}

/* Global Input/Select/Textarea Styling to match Plan Cards */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="radio"]:hover,
input[type="file"]:hover,
textarea:hover,
select:hover {
    animation: border-glow-gold-green 2s infinite;
    border-color: #f59e0b !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="radio"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    outline: none !important;
    animation: none;
}

/* Ensure radio buttons active state is also red */
input[type="radio"]:active {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}

/* Payment Option Card Styling */
.payment-option-card {
    background: linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%);
    border: 1px solid rgba(0,0,0,0.08); /* Default border matching menu-item-button */
    border-radius: 0.5rem; /* rounded-lg equivalent */
    padding: 1rem; /* p-4 equivalent */
    cursor: pointer;
    transition: all 0.2s ease;
}

.payment-option-card:hover {
    animation: border-glow-gold-green 2s infinite;
}

.payment-option-card:active {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}

/* Specific style for disabled menu item button (e.g., "Current Plan") */
.menu-item-button-disabled {
    background: #e2e8f0; /* Light gray background */
    color: #6b7280; /* Darker gray text */
    border-color: rgba(0,0,0,0.05);
    cursor: not-allowed;
    opacity: 0.75;
    box-shadow: none; /* No shadow for a flatter disabled look */
    pointer-events: none; /* Prevent clicks */
}

.menu-item-button-disabled:hover {
    background: #e2e8f0; /* Keep same background on hover */
    color: #6b7280; /* Keep same text color on hover */
    transform: translateY(0); /* No hover animation */
    box-shadow: none; /* No hover shadow */
}

/* Top loading bar styles */
#page-loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 999999;
  pointer-events: none;
  background: transparent;
}
#page-loading-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--page-loading-bar-color, #f59e0b); /* Use CSS variable, fallback to default */
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: width 150ms linear, opacity 220ms ease;
  will-change: width, opacity;
}

:root {
    --color-primary-blue: #006DBF;
    --text-shadow-light: -1px -1px 0 #f8f8f8, 1px -1px 0 #f8f8f8, -1px 1px 0 #f8f8f8, 1px 1px 0 #f8f8f8;
    /* New CSS variables for link styling */
    --link-default-color: #000000;
    --link-hover-color: #FFD700;
    --link-click-color: #006DBF;
    /* Removed --cassandra-link-default-color, --cassandra-link-hover-color, --cassandra-link-click-color */
    --link-text-shadow-color: #b2f2bb;
}

/* Custom font family */
.font-neuropol {
    font-family: 'Neuropol', sans-serif;
}

/* Custom text color */
.text-primary-blue {
    color: var(--color-primary-blue) !important;
}

.text-default-color {
    color: var(--default-text-color, #000000) !important;
}

/* Custom text shadow */
.text-shadow-light {
    text-shadow: var(--text-shadow-light);
}

.text-larger {
    font-size: larger;
}

.text-white-shadow-strong {
    color: #ffffff !important;
    text-shadow: -1px -1px 0 #000000, 1px -1px 0 #000000, -1px 1px 0 #000000, 1px 1px 0 #000000;
}

.bg-ourphysics {
    background-image: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)), url('../images/pic-1.png');
    background-size: cover;
    background-position: center;
}

.bg-services-intro {
    background-image: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('../images/1-3pic-1.png');
    background-size: cover;
    background-position: center;
}

/* Contact section background */
.contact-bg-image {
    background-image: url('../images/hero-5-img2-1-1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Contact info card background */
.contact-info-card-bg {
    background-image: linear-gradient(rgba(255,255,255,0.86), rgba(255,255,255,0.86)), url('../images/cassandra-tlogo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.app-link-style {
    color: var(--link-default-color);
    text-shadow: 1px 1px 0px var(--link-text-shadow-color), -1px -1px 0px var(--link-text-shadow-color), 1px -1px 0px var(--link-text-shadow-color), -1px 1px 0px var(--link-text-shadow-color);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.app-link-style:hover {
    color: var(--link-hover-color);
    text-shadow: none;
}

.app-link-style:active {
    color: var(--link-click-color);
}

/* Removed .app-cassandra-link-style and its rules */

.logo-img-link {
    background: transparent;
    border: none;
    display: inline-block;
}

.logo-img {
    background: transparent;
    border: none;
}

.logo-glow {
    filter: drop-shadow(0 0 10px #b2f2bb);
    transition: filter 0.3s ease-in-out;
}

.logo-glow:hover {
    filter: drop-shadow(0 0 10px #ffadad);
}


.logo-text-style {
    background: transparent;
    border: none;
    display: inline-block;
    padding: 0;
    margin: 0;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    color: black;
}

#mobileDisclaimerLink {
    color: var(--cassandra-link-default-color) !important; /* This will now use --link-default-color or be overridden */
}

#mobileDisclaimerLink:hover {
    color: var(--cassandra-link-hover-color) !important; /* This will now use --link-hover-color or be overridden */
}

#mobileDisclaimerLink:active {
    color: var(--link-click-color) !important; /* This will now use --link-click-color or be overridden */
}

/* Adjust mainpagetxt position */
#mainpagetxt {
    position: relative;
    /* top: -50px; */ /* Removed to match bannertest.php behavior */
}

.responsive-img-square {
    width: 100px;
    height: 100px;
    object-fit: cover;
}

/* Team Card Hover Effect */
@keyframes team-glow {
    0% { box-shadow: 0 0 5px var(--logo-digit-color); border-color: var(--logo-digit-color); }
    50% { box-shadow: 0 0 20px var(--logo-digit-color); border-color: var(--logo-digit-color); }
    100% { box-shadow: 0 0 5px var(--logo-digit-color); border-color: var(--logo-digit-color); }
}

.pro-glass-card:hover .team-photo {
    animation: team-glow 1.5s infinite;
    border: 3px solid var(--logo-digit-color);
}

.team-photo {
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

/* Plan Card Styling */
@keyframes border-glow-gold-green {
    0% {
        box-shadow: 0 0 5px #f59e0b;
        border-color: #f59e0b;
    }
    50% {
        box-shadow: 0 0 15px #b2f2bb;
        border-color: #b2f2bb;
    }
    100% {
        box-shadow: 0 0 5px #f59e0b;
        border-color: #f59e0b;
    }
}

@keyframes border-glow-green {
    0% {
        box-shadow: 0 0 5px #b2f2bb;
        border-color: #b2f2bb;
    }
    50% {
        box-shadow: 0 0 15px #b2f2bb;
        border-color: #b2f2bb;
    }
    100% {
        box-shadow: 0 0 5px #b2f2bb;
        border-color: #b2f2bb;
    }
}

.plan-card-style {
    background: linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%);
    border: 1px solid #f59e0b;
    border-radius: 0.75rem; /* rounded-xl equivalent */
    transition: all 0.3s ease;
}

.plan-card-style:hover {
    animation: border-glow-green 2s infinite;
    border-color: #b2f2bb !important;
}

.plan-card-style:active, .plan-card-style:focus-within {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}

/* Top Up Amount Button Styling */
.topup-amount-btn:hover {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
}

.topup-amount-btn.active {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none;
    background-color: #eff6ff; /* Optional: keep subtle background to indicate selection */
}

/* Styles from original pages/avcformulae.php */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(200, 200, 200, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Neuropol', 'Neuropol-2', sans-serif;
    font-size: 25px;
    color: #f59e0b;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Ensure menu title uses Neuropol font */
.menu-wrapper .logo a {
    font-family: 'Neuropol', sans-serif !important;
}
.menu-wrapper .logo a span {
    font-family: 'Neuropol', sans-serif !important;
}

body {
    margin: 0;
    padding: 0; /* Remove global padding from body */
}

/* Wrapper for avcformulae.php content to apply consistent margins */
.avc-content-wrapper {
    padding-left: 20px;
    padding-right: 20px;
}
.fa-window-maximize {
    text-shadow: 2px 2px 4px #000000;
}
div[onclick^="toggleCard"] {
    right: 8px !important;
}
div[onclick^="toggleGlobalControls"] {
    right: 8px !important;
}
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-family: 'Neuropol', 'Neuropol-2', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.global-controls {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 30px;
    position: sticky;
    top: 10px;
    z-index: 100;
    position: relative;
	transition: max-height 0.3s ease-out;
	overflow: hidden;
}
.global-title {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}
.global-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.global-control-group {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #e0e6ed;
}
.global-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}
.global-value {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin: 5px 0;
    color: #e74c3c;
}
input[type="range"], input[type="number"] {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 5px;
}
.formula-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 40px;
}
.formula-card {
    width: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 45px 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; /* Add this line */
}
.formula-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.formula-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}
.formula-equation {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
    border-left: 4px solid #3498db;
}
.local-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 20px 0;
    padding: 15px;
    background: #f0f5fa;
    border-radius: 8px;
    width: 100%;
}
.local-control-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 100%;
}
.local-control-group input[type="range"],
.local-control-group input[type="number"] {
    width: 100%;
}
.local-label {
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: 500;
}
.plot-container {
    width: 100%;
    max-width: 100%;
    height: 390px;
    margin-top: 20px;
    border: 1px solid #eee;
    border-radius: 5px;
}
.plot-container .user-select-none.svg-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 auto !important;
    display: block !important;
}
#vancampen-plot,
#ashby-plot,
#gap-plot,
#landauer-plot,
#symbiosis-plot,
#social-plot,
#interdependence-plot,
#pfpp-plot {
    width: 100%;
    max-width: 100%;
    height: 390px;
}
.description {
    font-size: 14px;
    color: #555;
    margin-top: 15px;
    line-height: 1.5;
}

.formula-card.collapsed .formula-equation,
.formula-card.collapsed .local-controls,
.formula-card.collapsed .plot-container,
.formula-card.collapsed .description {
    display: none;
}

.formula-card.collapsed {
    max-height: 50px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.global-controls.collapsed {
	max-height: 50px;
	overflow: hidden;
	transition: max-height 0.3s ease-out;
}
.tabs {
    display: flex;
    overflow-x: auto;
    margin-bottom: 20px;
    gap: 5px;
}
.tab {
    padding: 10px 20px;
    background: #e0e6ed;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}
.tab.active {
    background: #3498db;
    color: white;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.sync-toggle {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: #e8f4fd;
    border-radius: 5px;
}
.sync-toggle input {
    margin-right: 10px;
}
.linked-indicator {
    font-size: 12px;
    color: #27ae60;
    font-weight: bold;
    margin-top: 5px;
}
@media (max-width: 1024px) {
    .global-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    .plot-container,
    #vancampen-plot,
    #ashby-plot,
    #gap-plot,
    #landauer-plot,
    #symbiosis-plot,
    #social-plot,
    #interdependence-plot,
    #pfpp-plot {
        height: 350px;
    }
}
@media (max-width: 768px) {
    .avc-content-wrapper {
        padding-left: 15px;
        padding-right: 15px;
    }
    .global-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .local-controls {
        flex-direction: column;
        gap: 12px;
    }
    .local-control-group {
        flex: 1 1 100%;
        min-width: 0;
    }
    .plot-container,
    #vancampen-plot,
    #ashby-plot,
    #gap-plot,
    #landauer-plot,
    #symbiosis-plot,
    #social-plot,
    #interdependence-plot,
    #pfpp-plot {
        height: 330px;
    }
}
@media (max-width: 640px) {
    .avc-content-wrapper {
        padding-left: 12px;
        padding-right: 12px;
    }
    .global-grid {
        grid-template-columns: 1fr;
    }
    .plot-container,
    #vancampen-plot,
    #ashby-plot,
    #gap-plot,
    #landauer-plot,
    #symbiosis-plot,
    #social-plot,
    #interdependence-plot,
    #pfpp-plot {
        height: 310px;
    }
}

/* Buttons for card actions (copy, download, preview) */
.card-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.95);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    cursor: pointer;
    margin-right: 4px;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
}
.card-action-btn i { pointer-events: none; line-height: 1; }
/* Fullscreen card */
.formula-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 20000 !important;
    overflow: auto !important;
    padding: 24px !important;
    margin: 0;
}
/* Make plot taller when card is fullscreen */
.formula-fullscreen .plot-container {
    height: calc(100vh - 240px) !important;
    max-height: none !important;
}

/* Preview Button Style (based on send-menu-btn, but green) */
.preview-menu-btn {
    display: inline-block;
    height: 40px; /* Set button height to 40px */
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #e6ffe6 0%, #d9f7d9 100%); /* Light green gradient */
    border: 1px solid rgba(34,197,94,0.3); /* Green border */
    color: #16a34a; /* Darker green text */
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.18), inset 0 2px 0 rgba(255,255,255,0.6);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    text-align: center;
    text-decoration: none; /* Ensure no underline */
}
.preview-menu-btn:hover {
    transform: translateY(-2px);
    background: rgba(178,242,187,0.95); /* Lighter green hover */
    color: #0b1220;
    box-shadow: 0 10px 18px rgba(0,0,0,0.22), inset 0 2px 0 rgba(255,255,255,0.72);
}
.preview-menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.5);
}
.preview-menu-btn:focus {
    outline: 3px solid rgba(178,242,187,0.28);
    outline-offset: 2px;
}

/* Download Button Style (based on send-menu-btn, but blue) */
.download-menu-btn {
    display: inline-block;
    height: 40px; /* Set button height to 40px */
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #e6f2ff 0%, #d9e9f7 100%); /* Light blue gradient */
    border: 1px solid rgba(0,109,191,0.3); /* Blue border */
    color: #006DBF; /* Darker blue text */
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.18), inset 0 2px 0 rgba(255,255,255,0.6);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    text-align: center;
    text-decoration: none; /* Ensure no underline */
}
.download-menu-btn:hover {
    transform: translateY(-2px);
    background: rgba(178,210,242,0.95); /* Lighter blue hover */
    color: #0b1220;
    box-shadow: 0 10px 18px rgba(0,0,0,0.22), inset 0 2px 0 rgba(255,255,255,0.72);
}
.download-menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.5);
}
.download-menu-btn:focus {
    outline: 3px solid rgba(178,210,242,0.28);
    outline-offset: 2px;
}

/* New class for hover effect on action buttons */
.hover-text-accent:hover {
    color: #f59e0b !important;
}

/* Recaptcha container */
.recaptcha-wrapper {
    margin: 4px;
    height: 82px;
}

/* Footer styles */
.full-width-footer {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100vw !important; /* Use viewport width */
    padding-top: 3rem !important; /* Equivalent to py-12 */
    padding-bottom: 1rem !important; /* Changed from 3rem to 1rem */
    position: relative !important; /* Keep in normal flow */
    left: 50% !important;
    transform: translateX(-50%) !important; /* Center using transform */
}

.footer-heading {
    font-family: 'Neuropol', sans-serif;
    color: #38ADF0;
}

.footer-link {
    color: #9ca3af; /* text-gray-400 */
    transition: color 0.15s ease-in-out;
}
.footer-link:hover {
    color: #f59e0b;
}

.footer-copyright {
    font-size: 9px;
}
/* Floating Ankh Icon Container */
.ankh-float-container {
    position: fixed;
    bottom: 1px;
    left: 0px;
    z-index: 9999;
    background-color: transparent;
    border-radius: 50%;
    padding: 0; /* Remove padding */
    box-shadow: none;
    display: flex; /* Use flexbox to center content */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
}

.ankh-button {
    position: relative;
    top: 0; /* Remove top offset, let flexbox handle centering */
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.ankh-button .fa-ankh {
    font-size: 15px;
    color: #C04040;
    transition: color 0.3s ease;
}

.ankh-button:hover .fa-ankh {
    color: #006DBF;
}

.ankh-button .fa-ankh::before {
    content: "\f644";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.ankh-icon-glow {
    color: #C04040;
    animation: heartbeat-glow 1.5s infinite ease-in-out;
}

@keyframes heartbeat-glow {
    0% {
        filter: drop-shadow(0 0 4px #C04040);
    }
    50% {
        filter: drop-shadow(0 0 16px #C04040);
    }
    100% {
        filter: drop-shadow(0 0 4px #C04040);
    }
}

/* Replicating Tailwind Custom Colors classes used in userprofile.php */
.bg-primary-blue {
    background-color: var(--color-primary-blue) !important;
}

.border-primary-blue {
    border-color: var(--color-primary-blue) !important;
}

.ring-primary-blue {
    --tw-ring-color: var(--color-primary-blue) !important;
}

/* Focus states */
.focus\:ring-primary-blue:focus {
    --tw-ring-color: var(--color-primary-blue) !important;
}

.focus\:border-primary-blue:focus {
    border-color: var(--color-primary-blue) !important;
}

/* Peer states for toggles */
.peer:checked ~ .peer-checked\:bg-primary-blue {
    background-color: var(--color-primary-blue) !important;
}

/* For peer-focus:ring-primary-blue/50 */
.peer:focus ~ .peer-focus\:ring-primary-blue\/50 {
     --tw-ring-color: rgba(0, 109, 191, 0.5) !important;
}

/* Missing Tailwind classes for User Profile */
.w-11 {
    width: 2.75rem;
}

.top-0\.5 {
    top: 0.125rem;
}

.left-\[2px\] {
    left: 2px;
}

/* Violet colors */
.bg-violet-50 {
    background-color: #f5f3ff;
}

.text-violet-700 {
    color: #6d28d9;
}

.hover\:bg-violet-100:hover {
    background-color: #ede9fe;
}

/* File input styling */
.file\:mr-4::file-selector-button {
    margin-right: 1rem;
}

.file\:py-2::file-selector-button {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.file\:px-4::file-selector-button {
    padding-left: 1rem;
    padding-right: 1rem;
}

.file\:rounded-full::file-selector-button {
    border-radius: 9999px;
}

.file\:border-0::file-selector-button {
    border-width: 0;
}

.file\:text-sm::file-selector-button {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.file\:font-semibold::file-selector-button {
    font-weight: 600;
}

.file\:bg-violet-50::file-selector-button {
    background-color: #f5f3ff;
}

.file\:text-violet-700::file-selector-button {
    color: #6d28d9;
}

.hover\:file\:bg-violet-100:hover::file-selector-button {
    background-color: #ede9fe;
}

/* Additional missing Tailwind classes */
.min-h-screen {
    min-height: 100vh;
}

.space-x-6 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
    margin-right: calc(1.5rem * var(--tw-space-x-reverse));
    margin-left: calc(1.5rem * (1 - var(--tw-space-x-reverse)));
}

.shrink-0 {
    flex-shrink: 0;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.ring-4 {
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.peer:focus ~ .peer-focus\:ring-4 {
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

@media (min-width: 640px) {
    .sm\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.team-photo {
    width: 128px !important;
    height: 128px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

/* ===========================================================================
   Cassandra AI Page Styles
   =========================================================================== */

/* Hero background with dynamic image (used by cassandra-ai.php) */
.cassandra-hero-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Main content wrapper for Cassandra page */
/* Cassandra content card uses w-full pro-glass-card classes from HTML */
/* Padding is handled by Tailwind classes px-5 py-3 */

/* Intro text container */
.cassandra-intro-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--default-text-color, #000000);
    margin-bottom: 1rem;
}

/* Role title styling */
.cassandra-role-title {
    font-family: 'Neuropol', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--hero-title-color, #006DBF);
    display: block;
    margin-bottom: 0.5rem;
}

/* Role section styling */
.cassandra-role-section {
    margin-top: 1.5rem;
}

/* Image wrapper with glow effect */
.cassandra-img-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* Image container for centering */
.cassandra-img-container {
    max-width: 320px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
    margin: 1.5rem auto;
}

/* Cassandra portrait image */
.cassandra-img {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cassandra-portrait {
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.cassandra-img-wrap:hover .cassandra-img {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* Plasma glow effect behind the image */
.cassandra-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(120deg, #006dbf 0%, #38adf0 25%, #f59e0b 50%, #b2f2bb 75%, #ffd700 100%);
    background-size: 400% 400%;
    filter: blur(14px) saturate(1.2);
    border-radius: 0.75rem;
    z-index: -1;
    opacity: 0.8;
    animation: plasma-flow 3s linear 1 forwards;
    transition: filter 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.cassandra-img-wrap:hover .cassandra-glow {
    filter: blur(16px) saturate(1.25);
    transform: scale(1.02);
    opacity: 1;
}

/* Trigger link for Cassandra name */
.cassandra-trigger-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.cassandra-trigger-link:hover {
    text-decoration: none;
}

/* Fill spacer for footer positioning */
#cassandra-fill-spacer {
    flex-shrink: 0;
}

/* Responsive adjustments for Cassandra page */
@media (max-width: 768px) {
    .cassandra-role-title {
        font-size: 1.25rem;
    }
    
    .cassandra-intro-text {
        font-size: 1rem;
    }
    
    .cassandra-img-container {
        max-width: 320px;
    }
    
    .cassandra-img {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .cassandra-role-title {
        font-size: 1.125rem;
    }
    
    .cassandra-img-container {
        max-width: 320px;
    }
    
    .cassandra-img {
        max-width: 300px;
    }
}

/* ===========================================================================
   Modal Backdrop Styles
   =========================================================================== */

/* Modal Backdrop Styles */
#s4a-modal-backdrop {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2147483647 !important;
}
#s4a-modal {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  /* background handled by pro-glass-card/inline style */
  /* border-radius handled by pro-glass-card */
  /* border handled by pro-glass-card */
  padding: 24px;
  text-align: left;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: #0b1220;
  display: flex;
  flex-direction: column;
}
#s4a-modal h4 {
  margin: 0 0 16px 0;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}
#s4a-modal p {
  margin: 0 0 16px 0;
  color: #20232a;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 10px;
}
#s4a-modal .s4a-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 0.5rem;
  background: var(--btn-bg-color, linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%));
  border: 1px solid var(--btn-border-color, rgba(0,0,0,0.14));
  color: var(--btn-text-color, #1e40af);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 12px var(--btn-shadow-color, rgba(0,0,0,0.18)), inset 0 2px 0 rgba(255,255,255,0.6);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  flex-shrink: 0;
  align-self: center;
}
#s4a-modal .s4a-ok:hover {
  transform: translateY(-2px);
  background: var(--btn-hover-bg, linear-gradient(180deg, #ffffff 0%, #e9e9ea 100%));
  animation: border-glow-gold-green 2s infinite;
  color: var(--btn-hover-text-color, #0b1220);
  border-color: var(--btn-hover-border-color, #f59e0b);
}
#s4a-modal.success .s4a-ok {
  background: #e6f9ef;
  border-color: rgba(34,197,94,0.25);
  box-shadow: 0 6px 18px rgba(34,197,94,0.12);
}

@media (max-width: 768px) {
  #s4a-modal {
    padding: 20px;
  }
}

/* Landscape optimization for small heights */
@media (orientation: landscape) and (max-height: 500px) {
  #s4a-modal {
    padding: 12px;
  }
  #s4a-modal h4 {
    margin-bottom: 8px;
    font-size: 1.25rem;
  }
  #s4a-modal p {
    margin-bottom: 8px;
  }
  #s4a-modal .s4a-ok {
    padding: 8px 20px;
  }
}

/* ===========================================================================
   Chat Widget Tool Icon Buttons - Colored Background
   =========================================================================== */

/* Bot message tool icons with colored background like attachment button */
.bot-msg-tools button,
.user-msg-tools button {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.6);
    color: #495057;
    transition: all 0.2s ease;
}

.bot-msg-tools button:hover,
.user-msg-tools button:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f1f3f4 100%);
    border-color: var(--chat-btn-color, #f59e0b);
    box-shadow: 0 3px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.8);
    color: var(--chat-btn-color, #f59e0b);
    transform: translateY(-1px);
}

.bot-msg-tools button:active,
.user-msg-tools button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.4);
}

/* Download menu dropdown buttons */
.download-menu-dropdown button {
    background: transparent;
    border: none;
    box-shadow: none;
}

.download-menu-dropdown button:hover {
    background: #f3f4f6;
    border: none;
    box-shadow: none;
    transform: none;
}

/* ===========================================================================
   Chatbox Scroll Buttons - Glass Effect (matches main page scroll widget)
   =========================================================================== */
.chat-scroll-btn {
    background: rgba(178,242,187,0.40) !important; /* Glass effect green tint */
    border: 1px solid rgba(0,0,0,0.12) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: all 0.2s ease !important;
}

.chat-scroll-btn:hover {
    animation: border-glow-gold-green 2s infinite !important;
    border-color: #f59e0b !important;
    background: rgba(178,242,187,0.60) !important;
    opacity: 1 !important;
}

.chat-scroll-btn:active {
    border-color: #ff0000 !important;
    box-shadow: 0 0 10px #ff0000 !important;
    animation: none !important;
}

/* ===========================================================================
   KaTeX LaTeX Rendering - Font Size Normalization
   Ensures LaTeX math renders at the same size as surrounding text
   Default KaTeX is 1.21em (21% larger), we normalize to 1em
   =========================================================================== */

/* Chat widget, preview, and general context KaTeX sizing */
.katex {
    font-size: 1em !important;
}

/* Display math blocks should also match body text size */
.katex-display > .katex {
    font-size: 1em !important;
}

/* Inline LaTeX wrapper styling */
.latex-inline {
    display: inline;
    white-space: nowrap;
}

.latex-inline .katex {
    display: inline !important;
    font-size: 1em !important;
}

/* Ensure consistent Mermaid diagram styling */
.mermaid {
    background: white;
    margin: 16px 0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
}

/* Inline code in chat messages
 * Backtick-wrapped words like `mass`, `information`, `energy` render as <code> elements.
 * Without this rule they would display in monospace font (browser default) which looks
 * dramatically different from surrounding text in terms of font-family and sometimes size.
 *
 * This rule makes inline code within chat bubbles use the SAME font-family and font-size
 * as the surrounding chat text, while still showing a subtle highlight background so the
 * reader can recognise these as technical terms (not a KaTeX formula or plain prose).
 *
 * Note: pre > code (block code inside <pre>) is intentionally EXCLUDED so that code blocks
 * (multi-line) continue to render in monospace as expected.
 */
.bot-content code:not(pre > code),
.markdown-content code:not(pre > code),
.message-enter code:not(pre > code) {
    font-family: var(--chat-font-family, inherit) !important;
    font-size: var(--chat-font-size, inherit) !important;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: inherit;
    white-space: normal;
}

/* Mermaid within chat messages */
.bot-content .mermaid,
.message-enter .mermaid {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    margin: 0;
}

/* Mermaid diagram wrapper and toolbar */
.mermaid-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.mermaid-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.mermaid-wrapper:hover .mermaid-toolbar {
    opacity: 1;
}

.mermaid-toolbar button {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mermaid-toolbar button:hover {
    background: #fff;
    border-color: #aaa;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.mermaid-toolbar button svg {
    width: 16px;
    height: 16px;
    stroke: #555;
}

.mermaid-toolbar button:hover svg {
    stroke: #333;
}

/* Touch device support - always show toolbar */
@media (hover: none) {
    .mermaid-toolbar {
        opacity: 1;
    }
}

/* =========================================
   Gemini-Style Animated Spinner
   ========================================= */

@keyframes gemini-spinner-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes gemini-spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

@keyframes gemini-spinner-color {
    0%, 100% { stroke: #4285f4; }
    25% { stroke: #ea4335; }
    50% { stroke: #fbbc04; }
    75% { stroke: #34a853; }
}

.gemini-spinner {
    width: 24px;
    height: 24px;
    animation: gemini-spinner-rotate 1.4s linear infinite;
}

.gemini-spinner-lg {
    width: 36px;
    height: 36px;
}

.gemini-spinner circle {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    animation: 
        gemini-spinner-dash 1.4s ease-in-out infinite,
        gemini-spinner-color 5.6s ease-in-out infinite;
}

/* Single color variant (blue only) */
.gemini-spinner-blue circle {
    animation: gemini-spinner-dash 1.4s ease-in-out infinite;
    stroke: #3b82f6;
}

/* =========================================================================
 * AGENT MESSAGE LAYOUT - Profile icon and text bubble alignment
 * Profile image: 2px from left edge of chatbox
 * Text bubble: 4px gap from profile image, 2px from right edge
 * ========================================================================= */
#chat-messages .message-enter.flex.items-start.space-x-2 {
    gap: 4px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
    align-items: flex-start !important;
}

/* Agent text bubble - fill available width, proper text wrapping */
#chat-messages .message-enter.flex.items-start .max-w-\[calc\(100\%-3rem\)\] {
    max-width: calc(100% - 44px) !important;
    width: calc(100% - 44px) !important;
    flex: 1;
    min-width: 0;
}

/* Agent text content - proper word wrapping and alignment */
.bot-content {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
    max-width: 100% !important;
    overflow-x: auto !important;
}

/* Paragraph spacing in chat messages (Tailwind preflight resets p margin to 0) */
.bot-content p,
.markdown-content p {
    margin-bottom: 0.75em;
}
.bot-content p:last-child,
.markdown-content p:last-child {
    margin-bottom: 0;
}

/* CRITICAL FIX: Preserve whitespace in italic/em tags - fixes space stripping bug */
#chat-messages em,
#chat-messages i,
.bot-content em,
.bot-content i,
.markdown-content em,
.markdown-content i {
    white-space: normal !important;
    word-spacing: normal !important;
    letter-spacing: normal !important;
}


/* =========================================================================
 * TABLE STYLING - Chat widget, HTML artifacts, and general markdown tables
 * Added v1.0.152 - Properly aligned, professional table styles
 * ========================================================================= */

/* Base table structure */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
    margin: 16px 0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    margin: 0;
}

.markdown-content table,
.chat-content table,
.bot-content table,
div[class*="chat"] table,
.rendered-content table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

/* Table header */
.markdown-content table thead,
.chat-content table thead,
.bot-content table thead,
div[class*="chat"] table thead,
.rendered-content table thead {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: #ffffff;
}

.markdown-content table th,
.chat-content table th,
.bot-content table th,
div[class*="chat"] table th,
.rendered-content table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.15);
    border-top: none;
}

/* Suppress <br> tags inside table cells.
 * markdown-it with breaks:true converts every \n to <br>, including those
 * at the end of GFM table rows, which creates unwanted visible <br> tags
 * appended to the last cell content of each row.
 * Hiding them with CSS is the safe fix that doesn't affect non-table content.
 */
.markdown-content table td br:not(.aibr),
.markdown-content table th br:not(.aibr),
.chat-content table td br:not(.aibr),
.chat-content table th br:not(.aibr),
.bot-content table td br:not(.aibr),
.bot-content table th br:not(.aibr),
div[class*="chat"] table td br:not(.aibr),
div[class*="chat"] table th br:not(.aibr),
.rendered-content table td br:not(.aibr),
.rendered-content table th br:not(.aibr) {
    display: none;
}

.markdown-content table th:last-child,
.chat-content table th:last-child,
.bot-content table th:last-child,
div[class*="chat"] table th:last-child,
.rendered-content table th:last-child {
    border-right: none;
}

/* Table body cells */
.markdown-content table td,
.chat-content table td,
.bot-content table td,
div[class*="chat"] table td,
.rendered-content table td {
    padding: 9px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    word-break: break-word;
    min-width: 80px;
}

.markdown-content table td:last-child,
.chat-content table td:last-child,
.bot-content table td:last-child,
div[class*="chat"] table td:last-child,
.rendered-content table td:last-child {
    border-right: none;
}

/* Striped rows */
.markdown-content table tbody tr:nth-child(2n),
.chat-content table tbody tr:nth-child(2n),
.bot-content table tbody tr:nth-child(2n),
div[class*="chat"] table tbody tr:nth-child(2n),
.rendered-content table tbody tr:nth-child(2n) {
    background-color: #f8fafc;
}

/* Hover highlight */
.markdown-content table tbody tr:hover,
.chat-content table tbody tr:hover,
.bot-content table tbody tr:hover,
div[class*="chat"] table tbody tr:hover,
.rendered-content table tbody tr:hover {
    background-color: #eff6ff;
    transition: background-color 0.15s ease;
}

/* Last row: no bottom border */
.markdown-content table tbody tr:last-child td,
.chat-content table tbody tr:last-child td,
.bot-content table tbody tr:last-child td,
div[class*="chat"] table tbody tr:last-child td,
.rendered-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Numeric columns: right-align */
.markdown-content table td.num,
.chat-content table td.num,
.rendered-content table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Table caption */
.markdown-content table caption,
.chat-content table caption,
.rendered-content table caption {
    font-size: 0.8rem;
    font-style: italic;
    color: #6b7280;
    caption-side: bottom;
    margin-top: 4px;
    text-align: center;
}

/* Responsive scrollbar for wide tables */
.table-wrapper::-webkit-scrollbar,
.markdown-content table::-webkit-scrollbar,
.chat-content table::-webkit-scrollbar,
.rendered-content table::-webkit-scrollbar {
    height: 4px;
}

.markdown-content table::-webkit-scrollbar-track,
.chat-content table::-webkit-scrollbar-track,
.rendered-content table::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.markdown-content table::-webkit-scrollbar-thumb,
.chat-content table::-webkit-scrollbar-thumb,
.rendered-content table::-webkit-scrollbar-thumb {
    background: #93c5fd;
    border-radius: 2px;
}
