:root {
    /* Core Brand Colors */
    --brick: #9a3412;
    --brick-hover: #7c2d12;
    --brick-subtle: rgba(154, 52, 18, 0.1);
    
    /* Dynamic Text Colors */
    --brick-text: #9a3412; /* Darker for light mode */
    
    /* Light Mode Variables (Default) */
    --bg-body: #fafaf9; /* stone-50 */
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f5f5f4; /* stone-100 */
    --text-primary: #1c1917; /* stone-900 */
    --text-secondary: #57534e; /* stone-600 */
    
    /* UPDATED: Darker border and stronger shadow for better contrast on light theme */
    --border-color: #d6d3d1; /* stone-300 (Was #e7e5e4) */
    --grid-color: #e7e5e4;
    --nav-bg-scrolled: rgba(255, 255, 255, 0.9);
    --shadow-color: rgba(0, 0, 0, 0.12); /* Increased opacity (Was 0.08) */
    --shadow-hover: rgba(154, 52, 18, 0.15);
    
    --primary-font: 'Inter', sans-serif;
    --mono-font: 'JetBrains Mono', monospace;
    
    /* Animation Timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] {
    --bg-body: #0c0a09; /* stone-950 */
    --bg-surface: #171514; /* stone-900 custom */
    --bg-surface-secondary: #252220; /* stone-800 custom */
    
    /* Updated Font Colors for Better Visibility */
    --text-primary: #ffffff; /* Pure White */
    --text-secondary: #d6d3d1; /* stone-300 - Lighter for contrast */
    --brick-text: #fb923c; /* Orange-400 for better visibility on dark */
    
    --border-color: #44403c; /* stone-700 (Darker for dark mode to blend better) */
    --grid-color: #292524;
    --nav-bg-scrolled: rgba(12, 10, 9, 0.85);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --shadow-hover: rgba(251, 146, 60, 0.2); /* Orange glow */
    --brick-subtle: rgba(251, 146, 60, 0.15);
}

body {
    font-family: var(--primary-font);
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.4s var(--ease-out-expo), color 0.4s var(--ease-out-expo);
}

/* --- Theme-based Logo Visibility --- */
/* Light theme - show blue logo, hide white logo */
[data-bs-theme="light"] .d-light,
html:not([data-bs-theme="dark"]) .d-light {
    display: inline-block !important;
}
[data-bs-theme="light"] .d-dark,
html:not([data-bs-theme="dark"]) .d-dark {
    display: none !important;
}

/* Dark theme - show white logo, hide blue logo */
[data-bs-theme="dark"] .d-light {
    display: none !important;
}
[data-bs-theme="dark"] .d-dark {
    display: inline-block !important;
}

/* Logo cropping - remove extra space from top and bottom */
.navbar-logo, .footer-logo {
    object-fit: cover;
    object-position: center;
    margin-top: -30px;
    margin-bottom: -30px;
}

/* --- Utility Classes & Overrides --- */
.text-brick { color: var(--brick-text) !important; }
.bg-brick { background-color: var(--brick) !important; }
.border-brick { border-color: var(--brick) !important; }

.bg-surface { background-color: var(--bg-surface) !important; }
.bg-surface-secondary { background-color: var(--bg-surface-secondary) !important; }
.text-primary-custom { color: var(--text-primary) !important; }
.text-secondary-custom { color: var(--text-secondary) !important; }

/* Buttons */
.btn-brick {
    background-color: var(--brick);
    color: white;
    border: none;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: 8px;
    transition: all 0.3s var(--ease-out-expo);
    box-shadow: 0 4px 6px -1px rgba(154, 52, 18, 0.2);
}
.btn-brick:hover {
    background-color: var(--brick-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(154, 52, 18, 0.3);
}

.btn-outline-custom {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    padding: 12px 28px;
    border-radius: 8px;
    transition: all 0.3s var(--ease-out-expo);
}
.btn-outline-custom:hover {
    border-color: var(--brick-text);
    color: var(--brick-text);
    background-color: var(--brick-subtle);
    transform: translateY(-1px);
}

/* --- Scroll Reveal Animation Class --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--ease-out-expo);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- Navbar --- */
.navbar {
    padding: 1.5rem 0;
    transition: all 0.3s ease;
    background-color: transparent;
}
.navbar.scrolled {
    padding: 0.75rem 0;
    background: var(--nav-bg-scrolled);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.navbar-brand .logo-box {
    width: 36px;
    height: 36px;
    background-color: var(--brick);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono-font);
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 6px;
    margin-right: 10px;
    box-shadow: 0 4px 6px -1px rgba(154, 52, 18, 0.3);
}
.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.nav-link:hover, .nav-link.active {
    color: var(--brick-text);
}

/* Theme Toggle Button */
#theme-toggle {
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 12px;
    background: var(--bg-surface);
    transition: all 0.2s ease;
}
#theme-toggle:hover {
    border-color: var(--brick-text);
    color: var(--brick-text);
    transform: rotate(15deg);
}

/* --- Badges --- */
.badge-pill-custom {
    padding: 0.5em 1em;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: 9999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brick-text);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Specific Dark Mode overrides for Bootstrap badges */
[data-bs-theme="dark"] .bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
}
[data-bs-theme="dark"] .text-success {
    color: #4ade80 !important;
}
[data-bs-theme="dark"] .bg-warning-subtle {
    background-color: rgba(234, 88, 12, 0.15) !important; /* using orange/brick tint */
}

/* --- Hero Section --- */
.hero-section {
    padding-top: 160px;
    padding-bottom: 100px;
    position: relative;
    overflow: hidden;
}
.hero-bg-pattern {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
                      linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    opacity: 0.5;
    z-index: -1;
}
.hero-glow-1 {
    position: absolute;
    top: -10%; right: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(154, 52, 18, 0.12) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.8;
}
.hero-glow-2 {
    position: absolute;
    bottom: 0; left: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(87, 83, 78, 0.1) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.8;
}

/* --- Dashboard Visual --- */
.dashboard-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    overflow: hidden;
    transition: transform 0.5s var(--ease-out-expo);
}
.dashboard-preview:hover {
    transform: translateY(-5px) scale(1.01);
}
.window-controls {
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.control-dot { width: 10px; height: 10px; border-radius: 50%; transition: opacity 0.2s; }
.window-controls:hover .control-dot { opacity: 0.8; }

/* --- Services Cards --- */
.service-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    transition: all 0.4s var(--ease-out-expo);
    height: 100%;
    position: relative;
    z-index: 1;
    /* Added explicit shadow for better separation in light mode */
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}
.service-card:hover {
    border-color: var(--brick-text);
    background: var(--bg-surface);
    box-shadow: 0 20px 40px -5px var(--shadow-hover);
    transform: translateY(-8px);
    z-index: 2;
}
.icon-box {
    width: 64px;
    height: 64px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brick-text);
    margin-bottom: 1.5rem;
    transition: all 0.4s var(--ease-out-expo);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.service-card:hover .icon-box {
    background: var(--brick);
    color: white;
    border-color: var(--brick);
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 10px 15px -3px rgba(154, 52, 18, 0.3);
}

/* --- Client Logos Marquee --- */
.scroller-mask {
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}
.marquee-container {
    display: flex;
    gap: 5rem;
    width: max-content;
}
.scroll-left { animation: scrollLeft 60s linear infinite; }
.scroll-right { animation: scrollRight 60s linear infinite; }

@keyframes scrollLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@keyframes scrollRight {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

.logo-item {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    opacity: 0.6;
    filter: grayscale(100%);
}
.logo-item:hover {
    color: var(--text-primary);
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.05);
}
/* Ensure logos are visible in dark mode */
[data-bs-theme="dark"] .logo-filter {
    filter: grayscale(1); /* Removed invert(1) to avoid hiding text that is already light */
    opacity: 0.7;
}

/* Manually fix specific dark elements in logos for dark mode visibility */
[data-bs-theme="dark"] .logo-item .bg-dark {
    background-color: var(--text-primary) !important; /* Turns black badge to white */
    color: var(--bg-body) !important; /* Turns white text inside badge to black */
}
[data-bs-theme="dark"] .logo-item .border-dark {
    border-color: var(--text-primary) !important; /* Turns black border to white */
}

[data-bs-theme="light"] .logo-filter {
    filter: grayscale(1);
    opacity: 0.6;
}

/* --- Testimonials --- */
.testimonial-box {
    background: #292524;
    color: white;
    border-radius: 1rem;
    padding: 3rem;
    position: relative;
}
.carousel-indicators [data-bs-target] {
    background-color: var(--brick);
    width: 10px; height: 10px; border-radius: 50%;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all 0.3s;
}
.carousel-indicators .active {
    transform: scale(1.2);
    border-color: white;
}

/* --- Contact Form --- */
.form-control, .form-select {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 14px;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.2s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brick-text);
    box-shadow: 0 0 0 4px var(--brick-subtle);
    background-color: var(--bg-surface);
    color: var(--text-primary);
}
.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* --- Floating WhatsApp --- */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25D366;
    color: white;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.whatsapp-float:hover {
    transform: scale(1.1) translateY(-5px);
    color: white;
    box-shadow: 0 15px 30px -5px rgba(37, 211, 102, 0.6);
}

/* --- Footer --- */
footer {
    background: var(--bg-surface-secondary);
    border-top: 1px solid var(--border-color);
}
.social-icon {
    width: 44px; height: 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s var(--ease-out-expo);
}
.social-icon:hover {
    background: var(--brick);
    color: white;
    border-color: var(--brick);
    transform: translateY(-3px);
}

/* Card image overlay gradient for better text readability if needed */
.card-img-top {
    transition: transform 0.6s ease;
}
.card:hover .card-img-top {
    transform: scale(1.05);
}
