﻿/* ===============================
   Base & Variables
================================= */
:root {
    --brand-border: #e2e8f0;
    --brand-text: #333;
    --brand-muted: #666;
    --card-radius: 12px;
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 10px rgba(0,0,0,0.15);
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Arial, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--brand-text);
}

/* Utility helpers */
.username-display {
    color: darkgreen;
    font-weight: 600;
}

.card {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
}

/* ====================================
   OPTIONAL: App-fit scaler (scoped)
   Use ONLY by wrapping content in .use-app-fit
==================================== */
.use-app-fit {
    /* Design reference size (not applied globally) */
    --base-w: 1400;
    --base-h: 800;
    --scale: min( calc(100vw / var(--base-w)), calc(100dvh / var(--base-h)) );
}

    .use-app-fit .app-fit-viewport {
        height: 100dvh;
        width: 100vw;
        overflow: auto;
        display: grid;
        place-items: start center;
        padding: 0;
    }

    .use-app-fit .app-fit {
        width: calc(var(--base-w) * 1px);
        height: calc(var(--base-h) * 1px);
        transform: scale(var(--scale));
        transform-origin: top center;
    }

@supports not (transform: scale(1)) {
    .use-app-fit .app-fit {
        transform: none;
    }
}

/* ====================================
   Layout bits you had (kept & cleaned)
==================================== */
.container-fluid.my-5 .row {
    display: flex;
    align-items: stretch;
}

    .container-fluid.my-5 .row > [class^="col-"] {
        display: flex;
        flex-direction: column;
    }

.col-md-4 .card,
.col-md-8 .card {
    height: 100%;
}

/* Header */
.site-header {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding-right: 5px 5px;
    border-bottom: 2px solid #ddd;
}

.site-logo {
    height: 40px;
    margin-left: 20px;
    padding-right: 10px;
}

.site-header-left {
    padding: 10px;
}

.site-header-center {
    padding: 10px;
}

.site-header-right {
}

/* Sidebar list items */
.list-group-item.sidebar-item {
    background-color: #fff !important;
    color: #333 !important;
    border: initial;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    padding-top: .40rem;
    padding-bottom: .30rem;
    font-size: 0.8rem;
    line-height: 1.25;
}

    .list-group-item.sidebar-item:hover {
        background-color: #e9ecef !important;
        color: #000 !important;
        border-left: 6px dotted #0056b3 !important;
    }

    .list-group-item.sidebar-item.active {
        background-color: #fff !important;
        color: #007bff !important;
        font-weight: bold;
        border-left: 6px solid #0056b3 !important;
        padding-left: 12px !important;
    }

        .list-group-item.sidebar-item.active a {
            color: #ff0000 !important;
        }

/* Product image frame */
.product-image-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Tighten headings in side columns */
.col-12.col-lg-4 h5 {
    margin-bottom: .25rem !important;
}

.col-12.col-lg-4 .small {
    margin-top: 0;
}

/* Part builder */
.part-builder {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.dropdown {
    padding: 5px 10px;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
}

.result {
    margin-top: 15px;
    font-size: 1.2rem;
    color: #333;
}

/* Your grid containers (kept) */
.containerlower {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
}

.container1 {
    display: grid;
    grid-template-columns: 400px 900px;
    box-sizing: border-box;
    border: 1px solid #333;
}

    .container1 .left {
        display: grid;
        grid-template-rows: 1fr 1fr 1fr;
        gap: 10px;
    }

        .container1 .left > div {
            border: 1px solid #ccc;
            padding: 10px;
        }

    .container1 .right {
        border: 1px solid #333;
        padding: 10px;
    }

/* =========================================
   HOME — Full-width, vertically scrolling,
   centered tiles (mobile-first)
========================================= */
.home-hero {
    /* Use modern viewport units so iOS/Android toolbars don't break height */
    min-height: 100svh;
    display: flex;
    align-items: center; /* vertical centering of the stack */
    justify-content: center; /* horizontal centering of the stack */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.home-tiles {
    /* vertical stack; one tile per row on phones */
    display: flex;
    flex-direction: column;
    align-items: center; /* keep tiles centered horizontally */
    gap: 1rem;
    /* Let the stack fill width on phones, but keep a nice column max */
    width: min(100dvw, 48rem);
    /* Allow vertical scrolling if content overflows */
    max-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: 0.75rem;
    box-sizing: border-box;
}

/* Each tile: rectangular (height ~ 50% of width), fills viewport width on phones */
.tile-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    /* Full-bleed width on phones, capped by .home-tiles width */
    width: 100%;
    max-width: 100%;
    /* 2:1 keeps height less than width */
    aspect-ratio: 2 / 1;
    padding: 0.85rem;
    background: #fff;
    border: 1px solid var(--brand-border);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease;
}

    .tile-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .tile-card h5 {
        margin: 0.25rem 0 0.15rem;
        font-size: clamp(1rem, 3.2vw, 1.25rem);
        color: var(--brand-text);
    }

    .tile-card p {
        margin: 0;
        font-size: clamp(.9rem, 2.8vw, 1rem);
        color: var(--brand-muted);
    }

/* Very small phones: slightly shorter tiles so nothing feels cramped */
@media (max-width: 390px) {
    .tile-card {
        aspect-ratio: 2.4 / 1;
        padding: 0.7rem;
    }
}

/* Tablets/Small laptops: allow slightly wider column, still centered */
@media (min-width: 768px) {
    .home-tiles {
        width: min(100dvw, 56rem);
    }
}

/* Desktops: optionally show two columns while keeping vertical rhythm */
@media (min-width: 992px) {
    .home-tiles {
        display: grid;
        grid-template-columns: repeat(2, minmax(18rem, 1fr));
        gap: 1.25rem;
        width: min(100dvw, 64rem);
    }

    .tile-card {
        width: 100%;
        max-width: none;
    }
}
/* Keep nav content clear of iOS safe area at the bottom when fixed or sticky */
.navbar,
.navbar * {
    /* no overflow issues on iOS */
    -webkit-tap-highlight-color: transparent;
}

@supports (padding: env(safe-area-inset-bottom)) {
    .navbar.fixed-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Make sure BI icons render with correct line-height and size */
.nav-link .bi {
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}
/* ===== Force ONE tile per row on phones (strong override) ===== */

/* If your home uses our .home-tiles wrapper, lock it to a vertical stack */
.home-tiles {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    gap: 1rem;
}

    /* Make every direct child (tile) take the full line */
    .home-tiles > * {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Kill any Bootstrap grid behaviour if col-* classes slipped in */
    .home-tiles [class^="col-"],
    .home-tiles [class*=" col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* If you accidentally used a CSS grid container for tiles, flatten it */
    .home-tiles.tiles-grid {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Keep tiles rectangular: height ~ 50% of width */
    .home-tiles .tile-card {
        aspect-ratio: 2 / 1;
    }

/* Only at ≥992px, allow two columns (optional) */
@media (min-width: 992px) {
    .home-tiles {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(18rem, 1fr));
        gap: 1.25rem;
        width: min(100dvw, 64rem);
    }

        .home-tiles > * {
            max-width: none !important;
        }
}
/* === FORCE SINGLE-COLUMN TILES ON ALL SIZES (desktop too) === */
.home-tiles {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    gap: 1rem;
    width: min(100dvw, 48rem); /* keep a nice readable column */
}

    .home-tiles > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }

    /* Nuke any Bootstrap grid that might sneak in */
    .home-tiles [class^="col-"],
    .home-tiles [class*=" col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

/* Explicitly override our earlier desktop grid */
@media (min-width: 992px) {
    .home-tiles {
        display: flex !important; /* not grid */
        grid-template-columns: none !important;
    }
}
/* ===== TILE CARD TEXT STYLES ===== */

/* Remove underlines on all text inside tile links */
a.tile-card {
    text-decoration: none !important;
    color: inherit; /* use normal text color */
}

    /* Make sure inner text never shows underline either */
    a.tile-card h5,
    a.tile-card p {
        text-decoration: none !important;
        color: var(--brand-text); /* or a custom color like #333 */
    }

    /* Hover effect: change <h5> color */
    a.tile-card:hover h5 {
        color: #007bff; /* Bootstrap blue, or choose any accent */
        transition: color 0.2s ease;
    }

    /* Optional: keep <p> muted and unchanged on hover */
    a.tile-card p {
        color: var(--brand-muted);
    }


.home-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
    background-color: #f8f9fa;
}

.home-tiles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
}

.tile-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 280px;
    height: 140px; /* ⬅️ reduced from ~200–250px */
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease-in-out;
    text-align: center;
    padding: 1rem;
}

    .tile-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

    /* Typography tweaks */
    .tile-card h5 {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 0.3rem;
        color: #212529;
    }

    .tile-card p {
        font-size: 0.9rem;
        color: #6c757d;
    }

/* 📱 Mobile adjustment */
@media (max-width: 768px) {
    .tile-card {
        width: 90%;
        height: 120px; /* slightly shorter for phones */
    }
}
