/* ============================================================
   REDBITE SYSTEMS - CORPORATE RED & BLACK MATERIAL DESIGN 3
   Slim theme — CSS variables + MDL overrides + special pseudo-elements.
   All component styling is handled by Tailwind utility classes in views.
   ============================================================ */

:root {
    /* Color Palette */
    --primary-red: #B71C1C;
    --primary-red-light: #D32F2F;
    --primary-red-dark: #7B1113;
    --accent-red: #E53935;

    --bg-black: #121212;
    --bg-surface: #1E1E1E;
    --bg-surface-2: #262626;
    --bg-surface-3: #2C2C2C;

    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --text-tertiary: #808080;

    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
    --glow-red: 0 0 20px rgba(183, 28, 28, 0.4);
    --glow-red-intense: 0 0 30px rgba(227, 57, 53, 0.6);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Layout heights */
    --utility-height: 42px;
    --header-height: 70px;
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-black);
    color: var(--text-primary);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.6;
    font-weight: 400;
    overflow-x: hidden;
    width: 100%;
    min-height: 100%;
}

body.no-scroll {
    overflow: hidden;
}

/* MDL layout fills full viewport */
.mdl-layout {
    min-height: 100vh !important;
}

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface-2); }
::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-red); }

::selection {
    background: var(--primary-red);
    color: white;
}

/* ============================================================
   BASE TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.8rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); }

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

a:hover { color: var(--primary-red); }

/* Sticky bars that must sit just below the fixed header.
   Uses CSS vars so any page can add this class. */
.sticky-below-header {
    top: calc(var(--utility-height) + var(--header-height)); /* 42+70 = 112px */
    transition: top 0.3s ease;
}
body.header-scrolled .sticky-below-header {
    top: 56px; /* matches HEADER_H_SCROLLED */
}

/* ============================================================
   UTILITY BAR  (fixed top bar above MDL header)
   ============================================================ */

.utility-bar {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    height: var(--utility-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.utility-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.utility-left,
.utility-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.utility-social {
    display: flex;
    gap: 10px;
    align-items: center;
}

.utility-social a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.utility-social a:hover {
    color: var(--primary-red);
    background: rgba(183,28,28,0.1);
}

.utility-link {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.utility-link:hover {
    color: white;
    background: rgba(183,28,28,0.15);
}

/* ============================================================
   MDL OVERRIDES  (all need !important to beat material.min.css)
   ============================================================ */

/* Utility bar scroll-collapse */
body.header-scrolled .utility-bar {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Nav header: MDL manages position:fixed and top:0.
   We only need background, shadow, z-index, and transition overrides. */
.mdl-layout__header {
    background: var(--bg-surface) !important;
    overflow: visible !important;
    z-index: 1100 !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.5) !important;
    border-bottom: 1px solid rgba(183,28,28,0.3) !important;
    transition: box-shadow 0.3s ease, background 0.3s ease !important;
}
body.header-scrolled .mdl-layout__header {
    top: 0 !important;
    box-shadow: 0 4px 30px rgba(0,0,0,0.7), 0 0 0 1px rgba(183,28,28,0.35) !important;
    background: rgba(30,30,30,0.97) !important;
}

/* Content padding — JS overrides MDL's inline style. 0 at rest; sections use
   their own py- padding. Shrinks to nav-row height when scrolled. */
.mdl-layout.mdl-layout--fixed-header > .mdl-layout__content {
    padding-top: 0 !important;
    transition: padding-top 0.3s ease;
}
body.header-scrolled .mdl-layout.mdl-layout--fixed-header > .mdl-layout__content {
    padding-top: 56px !important;
}

.mdl-layout__header-row {
    height: var(--header-height) !important;
    padding: 0 20px !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    transition: height 0.3s ease !important;
}
body.header-scrolled .mdl-layout__header-row {
    height: 56px !important;
}

.logo-image {
    width: 160px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.6)) drop-shadow(0 0 18px rgba(255,255,255,0.25));
    transition: height 0.3s ease, width 0.3s ease;
}
body.header-scrolled .logo-image {
    height: 80px;
    width: 120px;
}

/* Hide MDL's own drawer-button — we use our custom mobile toggle */
.mdl-layout__drawer-button { display: none !important; }

/* MDL Drawer */
.mdl-layout__drawer {
    background-color: var(--bg-surface) !important;
    border-right: 2px solid var(--primary-red);
}
.mdl-layout__drawer .mdl-layout-title {
    background: linear-gradient(135deg, var(--primary-red) 0%, #C41C1C 100%);
    color: white !important;
    padding: 25px;
    font-size: 1.2rem;
}

/* ============================================================
   BUTTONS  (used via class="btn btn-primary/btn-secondary" across all pages)
   ============================================================ */

.btn {
    padding: 14px 32px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--accent-red) 100%);
    color: var(--text-primary);
    box-shadow: var(--glow-red);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    box-shadow: var(--glow-red-intense);
    transform: translateY(-3px);
    color: var(--text-primary);
}

.btn-primary:active { transform: translateY(-1px); }

.btn-secondary {
    background: transparent;
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
}

.btn-secondary:hover {
    background: rgba(183, 28, 28, 0.1);
    border-color: var(--primary-red-light);
    color: var(--primary-red-light);
}

/* ============================================================
   SECTION & CONTAINER UTILITIES
   ============================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Section header underline (::after pseudo-element — not doable in Tailwind) */
.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-red));
    border-radius: 2px;
}

/* Card top-border accent line */
.card::before,
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red), var(--accent-red));
    border-radius: 2px 2px 0 0;
}

/* Service card hover — top line expand */
.service-card::before {
    left: 50%;
    width: 0;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}
.service-card:hover::before { width: 100%; }

/* Button ripple (::before hover fill) */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.btn-primary:hover::before { width: 300px; height: 300px; }

/* Portfolio card overlay */
.portfolio-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(183,28,28,0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.portfolio-card:hover .portfolio-image::after { opacity: 1; }

/* Hero animated blobs (pseudo-elements) */
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(183,28,28,0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 20s ease-in-out infinite;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(227,57,53,0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 25s ease-in-out infinite reverse;
}

/* Contact item icon (::before pseudo) */
.contact-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, rgba(183,28,28,0.3), rgba(227,57,53,0.1));
    border-radius: 50%;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(30px); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(183,28,28,0.4); }
    50%       { box-shadow: 0 0 40px rgba(183,28,28,0.6); }
}

.animate-slideup   { animation: slideInUp   0.6s ease-out; }
.animate-slideleft { animation: slideInLeft 0.6s ease-out; }
.animate-pulse     { animation: pulse-glow  2s ease-in-out infinite; }

/* ============================================================
   MOBILE NAV BAR  (standalone fixed bar outside MDL layout)
   ============================================================ */

/* Hidden on desktop — shown only via mobile media query below */
.mobile-nav-bar { display: none; }
.mobile-menu-toggle { display: none !important; }

@media (max-width: 768px) {
    /* Show standalone mobile top bar */
    .mobile-nav-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: var(--bg-surface);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 1300;
        padding: 0 16px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.4);
        transition: box-shadow 0.3s ease, background 0.3s ease;
    }

    body.header-scrolled .mobile-nav-bar {
        background: rgba(30,30,30,0.97);
        box-shadow: 0 4px 24px rgba(0,0,0,0.6), 0 0 0 1px rgba(183,28,28,0.25);
    }

    .mobile-nav-logo {
        height: 38px;
        width: auto;
        display: block;
        filter: drop-shadow(0 0 6px rgba(255,255,255,0.6)) drop-shadow(0 0 14px rgba(255,255,255,0.25));
    }

    /* Hamburger button inside the mobile bar */
    .mobile-nav-bar .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.06);
        border: 1px solid rgba(255,255,255,0.15);
        color: var(--text-primary);
        border-radius: 8px;
        padding: 6px;
        cursor: pointer;
        font-size: 28px;
        z-index: 1301;
    }

    /* Hide the old toggle inside MDL header row */
    .mdl-layout__header-row > .mobile-menu-toggle { display: none !important; }

    /* Hide utility bar on mobile */
    .utility-bar { display: none !important; }

    /* Collapse MDL desktop header to 0 height */
    .mdl-layout__header {
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Content pushes down by mobile-nav-bar height only */
    .mdl-layout__content,
    .mdl-layout.mdl-layout--fixed-header > .mdl-layout__content {
        padding-top: 58px !important;
        margin-top: 0 !important;
    }

    /* Nav panel slides from mobile-nav-bar bottom */
    .main-nav {
        top: 58px !important;
        max-height: calc(100vh - 58px) !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 8px 0 16px !important;
    }

    /* Mobile dropdown/mega-menu stacking */
    .main-nav .dropdown-menu,
    .main-nav .mega-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        margin-top: 4px;
    }

    .main-nav .mega-menu-grid { display: block; }

    body.no-scroll { overflow: hidden; }

    /* Responsive typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }

    .logo-image { width: 120px; height: 80px; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.1rem; }
    .logo-image { width: 100px; height: 70px; }

    /* On very small screens make dropdown full-width */
    .dropdown-menu {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        min-width: calc(100% - 20px) !important;
        margin: 10px !important;
    }
}
