:root {
    --primary-color: #1e3a8a;
    /* Mascot's Blue Cap */
    --accent-color: #84cc16;
    /* Mascot's Lime Glow */
    --accent-glow: rgba(132, 204, 22, 0.6);
    --bg-color: #fdfcf0;
    /* Cream/Tan matching mascot fur */
    --text-color: #1a1a1a;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* GLOBAL RESETS & BACKGROUND SETUP */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #262626;
    line-height: 1.6;
}

/* --- THE LIVE CAMERA BACKGROUND (Handheld Drift) --- */
body::before {
    content: "";
    position: fixed;
    top: -2.5%;
    /* Reduced margin */
    left: -2.5%;
    width: 105%;
    /* Reduced from 120% to show more of the image */
    height: 105%;
    background-image: url('../images/jungle-bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: -1;

    /* Animation: Subtle 'Live' Camera Drift */
    animation: cameraDrift 20s infinite alternate ease-in-out;
    will-change: transform;
}

@keyframes cameraDrift {
    0% {
        transform: scale(1.0) translate(0, 0) rotate(0deg);
    }

    50% {
        transform: scale(1.02) translate(-0.5%, -0.2%) rotate(0.1deg);
    }

    100% {
        transform: scale(1.04) translate(0.5%, 0.2%) rotate(-0.1deg);
    }
}

/* Ensure the main container stays legible on top */
main {
    background: transparent;
    margin: 2rem auto;
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    width: 95%;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid rgba(132, 204, 22, 0.5);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ff9800 !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.8), 0 0 20px rgba(255, 87, 34, 0.5);
}

.brand-logo span {
    color: #ff9800 !important;
    text-shadow: 0 0 10px #ff9800, 0 0 20px #ff5722;
}

/* Mascot Styles */
.mascot-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.mascot-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid #ff9800;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
}

/* Service Grid */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #ff9800 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    margin: 0 auto 1.5rem auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: inline-block;
    padding: 1.2rem 3rem;
    border-radius: 50px;
    box-shadow: 0 0 30px rgba(255, 152, 0, 0.4);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: #1a1a1a;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    display: inline-block;
    margin: 0.5rem auto;
    padding: 0.6rem 2rem;
    border-radius: 50px;
    box-shadow: 0 0 20px var(--accent-glow);
    border: 1px solid var(--accent-color);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.service-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 4px solid transparent;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    transition: var(--transition);
    z-index: -1;
}

.service-card:hover::before {
    background: rgba(255, 255, 255, 0.75);
}

.service-card.painting {
    background-image: url('/static/images/service_painting.png');
}

.service-card.plumbing {
    background-image: url('/static/images/service_plumbing.png');
}

.service-card.carpentry {
    background-image: url('/static/images/service_carpentry.png');
}

.service-card.sentry {
    background-image: url('/static/images/service_sentry.png');
    color: white;
}

.service-card.sentry::before {
    background: rgba(0, 31, 63, 0.85);
}

.service-card.automotive {
    background-image: url('/static/images/service_automotive.png');
    color: #FF9900;
}

.service-card.automotive::before {
    background: rgba(0, 0, 0, 0.7);
}

.service-card.hvac {
    background-image: url('/static/images/service_hvac.png');
    color: white;
}

.service-card.hvac::before {
    background: rgba(0, 0, 0, 0.6);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border-bottom-color: var(--accent-color);
}

.card-desc {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    color: #444;
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.service-card:hover .card-icon {
    transform: scale(1.1) translateY(-5px);
    color: var(--accent-color);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

/* Home Layout with Mascot */
.home-layout {
    display: flex;
    align-items: flex-start;
    gap: 5rem;
    /* Increased from 3rem to avoid overlap */
    margin-top: 2rem;
}

.mascot-side {
    flex: 0 0 300px;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pointing-mascot {
    width: 250px;
    height: 250px;
    object-fit: contain;
    border-radius: 50%;
    border: 5px solid var(--accent-color);
    background: white;
    animation: mascotFloat 3s ease-in-out infinite;
}

.mascot-bubble {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    font-weight: 700;
    color: var(--primary-color);
    margin-top: -20px;
    position: relative;
    border: 2px solid var(--accent-color);
    animation: mascotFloat 3s ease-in-out infinite;
    animation-delay: 0.5s;
}

@keyframes mascotFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Footer */
footer {
    background-color: #222;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

.footer-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .home-layout {
        flex-direction: column;
        align-items: center;
    }

    .mascot-side {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }
}

/* --- FORM VISIBILITY: GLASSMORPHISM & ORANGE GLOW --- */
.form-glass-container {
    background: rgba(253, 252, 240, 0.85);
    /* Semi-transparent Cream matching Mascot */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
}

.high-vis-glow {
    color: #fff !important;
    text-shadow:
        0 0 5px #ff9800,
        0 0 10px #ff9800,
        0 0 20px #ff5722 !important;
    font-weight: 900 !important;
    letter-spacing: 0.5px;
}

.quote-form label {
    color: #1a1a1a !important;
    /* Dark text for contrast on cream */
    font-weight: 700 !important;
    font-size: 1rem;
    display: block;
    margin-bottom: 5px;
}

.quote-form h3 {
    color: #ff9800 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    border-left: 4px solid #ff9800;
    padding-left: 15px;
    margin-bottom: 20px;
}

/* Global Section Header Glow */
h1,
h2,
h3 {
    color: #ff9800 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    font-weight: 800;
}

h2 {
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.gallery-section h2,
.service-area-section h2,
.deals-section h2 {
    text-align: center;
}

/* --- CHAT WIDGET STYLES (Unified Ruler Dock) --- */
.ruler-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 99999;
    padding: 10px;
    background: transparent;
    pointer-events: none;
    /* Let clicks pass through to site content */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Align bar to right like a tape measure out of its shell */
    padding-bottom: env(safe-area-inset-bottom);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ruler-dock * {
    pointer-events: auto;
    /* Re-enable clicks for items inside the dock */
}

/* THE AVATAR (Anchored to the dock) */
.mascot-avatar {
    position: absolute;
    bottom: 70px;
    /* Sits on top of the bar (50px bar height + padding) */
    right: 20px;
    width: 85px;
    /* Fixed size to prevent glitches */
    height: 85px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100000;
}

.mascot-avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

.mascot-avatar video {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    pointer-events: none;
}

/* THE INPUT BAR (The Ruler Visual) */
.chat-input-bar {
    /* Yellow Tape Measure Background */
    background: #FFC107;
    /* Ticks Marks (Measuring Tape Effect) */
    background-image:
        linear-gradient(90deg, #1a1a1a 1px, transparent 1px),
        linear-gradient(90deg, #1a1a1a 1px, transparent 1px);
    background-size: 10px 8px, 20px 15px;
    background-position: bottom left, bottom left;
    background-repeat: repeat-x;

    border-radius: 50px 0 0 50px;
    padding: 10px 15px 15px 20px;
    border: 2px solid #1a1a1a;
    border-right: none;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center;
    gap: 12px;

    /* Animation: Unroll from the right */
    transform-origin: right center;
    transform: scaleX(0);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease-in;

    max-width: 90%;
    width: auto;
}

.chat-input-bar.active {
    transform: scaleX(1);
    opacity: 1;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #1a1a1a;
}

.chat-input-wrapper input {
    background: transparent;
    border: none;
    color: #1a1a1a;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    outline: none;
    width: 250px;
}

.chat-input-wrapper button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.minimize-btn {
    background: transparent;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

/* TYPING INDICATOR */
.typing-pill {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--accent-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- COMIC SPEECH BUBBLES --- */
.comic-bubble {
    position: absolute;
    background: #fff;
    /* Solid white for classic comic feel */
    border: 4px solid #1a1a1a;
    border-radius: 12px;
    /* Slightly less rounded */
    padding: 12px 20px;
    color: #1a1a1a;
    font-weight: 800;
    font-size: 1rem;
    /* Blocky Comic Shadow */
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
    display: none;
    /* Initially hidden, triggered by JS */
    min-width: 150px;
    max-width: 250px;
    text-align: center;
    transform: rotate(-1deg);
    /* Slight tilt for hand-drawn look */
    line-height: 1.3;
}

.comic-bubble.show-always {
    display: block;
}

/* Bubble Tail */
.comic-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 30px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 15px 0 0;
    border-color: #1a1a1a transparent transparent transparent;
}

/* Inner tail to create the white fill */
.comic-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 34px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 0 0;
    border-color: white transparent transparent transparent;
    z-index: 101;
}

/* Bottom-positioned bubbles (tail points up) */
.comic-bubble.bubble-bottom::after {
    bottom: auto;
    top: -15px;
    border-width: 0 0 15px 15px;
    border-color: transparent transparent #1a1a1a transparent;
}

.comic-bubble.bubble-bottom::before {
    bottom: auto;
    top: -8px;
    border-width: 0 0 10px 10px;
    border-color: transparent transparent white transparent;
}

/* Animations */
.pop-in {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    80% {
        transform: scale(1.1) rotate(2deg);
    }

    100% {
        transform: scale(1) rotate(-1deg);
        opacity: 1;
    }
}

/* Chat-specific bubble adjustment - The Comic Box */
.mascot-avatar .comic-bubble {
    /* Removed display: none - Let the default and show-always control it */
    bottom: 90px;
    right: 0;
    left: auto;
    /* Moved to right, expand left */
    transform: translateX(0);
    /* Shift slightly */

    width: auto;
    min-width: 220px;
    max-width: 350px;

    background: #fff;
    border-color: #ff9800;
    box-shadow: -6px 6px 0px rgba(255, 152, 0, 0.3);
    /* Shadow to left */
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 10000;
    pointer-events: auto;
}

.chat-mascot-wrapper .comic-bubble::after {
    right: 20px;
    left: auto;
    bottom: -15px;
    border-width: 15px 0 0 15px;
    /* Points Right-Down */
    border-color: #ff9800 transparent transparent transparent;
}

.chat-mascot-wrapper .comic-bubble::before {
    right: 24px;
    left: auto;
    bottom: -9px;
    border-width: 10px 0 0 10px;
    border-color: white transparent transparent transparent;
}

/* Minimized Chat Label - Generic Style (Positions defined inline) */
.chat-label-bubble {
    position: absolute;
    /* top/right set inline in HTML */
    background: #fff;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    pointer-events: none;
    animation: floatLabel 3s ease-in-out infinite;
}

/* Tiny tail for the label */
.chat-label-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 45%;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 0 0;
    border-color: #1a1a1a transparent transparent transparent;
}

@keyframes floatLabel {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* --- MOBILE CHAT FIXES --- */
@media (max-width: 768px) {
    .ruler-dock {
        padding: 5px;
        /* Less padding on small screens */
    }

    .chat-input-bar {
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
        padding: 10px 10px 15px 10px;
    }

    .chat-input-wrapper {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    .chat-input-wrapper input {
        width: 100% !important;
        font-size: 16px;
        /* Prevent IOS zoom on focus */
    }

    .mascot-avatar {
        width: 70px;
        height: 70px;
        bottom: 60px;
        right: 10px;
    }

    .mascot-avatar .comic-bubble {
        max-width: 250px;
        bottom: 75px;
    }
}