﻿/* =========================================
   AlphaWells Theme v2 – Shell (Sidebar + Header) 
   ========================================= */

/* ---- Tokens (from palette) ---- */
:root {
    --aw-teal-700: #1A4E63; /* brand teal */
    --aw-teal-600: #058586;
    --aw-green-500: #6EB17E;
    --aw-gold-500: #FBB03B;
    --aw-red-500: #E4604D;  
    --aw-ink: #000000;
    --aw-white: #FFFFFF;
    --aw-topbar: #003145;  
    --aw-sidebar: #1A4E63;  
    --aw-shadow: 0 2px 9px rgba(0,0,0,.25); /* X=2 Y=2 Blur=9, 25% */
    --aw-divider: rgba(255,255,255,.08);
    --aw-muted: rgba(255,255,255,.65);
    --aw-heading: #06798C;
}

/* === Global typography === */
:root {
    --aw-font-sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Everything inherits Poppins by default */
html, body {
    font-family: var(--aw-font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure Bootstrap controls inherit (some themes hard-set fonts) */
.btn,
.form-control,
.input-group-text,
.dropdown-menu,
.navbar,
.badge,
.modal,
.toast,
.pagination,
.breadcrumb,
.table,
.card,
.alert,
.list-group,
.popover,
.tooltip {
    font-family: inherit;
}

/* =========================================
   Page Heading — 
   Poppins / 500 / 36px / -3% / 100% line-height
   ========================================= */

h1,
.h1 {
    font-family: var(--aw-font-sans);
    font-weight: 500;
    font-style: normal;
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--aw-heading);
    margin: 0 0 1rem 0;
}

.aw-heading {
    font-family: var(--aw-font-sans);
    font-weight: 500;
    font-style: normal;
    letter-spacing: -0.03em;
    color: var(--aw-heading);
    line-height: 1.05;
    margin: 0 0 0.85rem 0;
}

/* Utility: brand background */
.bg-aw-heading {
    background-color: var(--aw-heading) !important;
    color: #ffffff !important;
}

.bg-aw-teal {
    background-color: var(--aw-teal-600) !important;
    color: #ffffff !important;
}

/* if you ever need a smaller section title: */
.page-subtitle {
    font-family: var(--aw-font-sans);
    font-weight: 500;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #2f3a3f;
    margin: .25rem 0 .75rem;
}

/* =========================================
   SIDEBAR (left rail)
   width: 250px  
   ========================================= */
#sidebar {
    width: 250px;
    min-height: 100vh;
    max-height: 100vh;
    background: var(--aw-sidebar);
    color: var(--aw-white);
    flex: 0 0 250px; /* fixed column in flex layout */
    position: fixed; /* CHANGED: fixed position for proper collapse */
    top: 0;
    left: 0;
    box-shadow: var(--aw-shadow);
    z-index: 1010; /* above content, below header */
    transition: transform .3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Mobile: sidebar hidden by default, slides in when active */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        transform: translateX(-100%);
    }

        #sidebar.active {
            transform: none; /* slide in when toggled */
        }
}

/* Desktop: sidebar visible by default, hides when active */
@media (min-width: 992px) {
    #sidebar {
        transform: translateX(0);
        transition: transform 0.3s ease;
    }

        #sidebar.active {
            transform: translateX(-100%);
        }

    /* When sidebar is visible, shift content right */
    #content,
    .main-content {
        margin-left: 250px !important;
        transition: margin-left 0.3s ease;
        width: calc(100% - 250px) !important;
    }

    /* When sidebar is hidden (active), content takes full width */
    #sidebar.active ~ #content,
    #sidebar.active ~ .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* CRITICAL: Hide overlay on desktop - it's only for mobile */
    .overlay {
        display: none !important;
        background: none !important;
    }

    /* Ensure body scrolling works properly on desktop */
    html, body {
        height: auto !important;
        overflow-y: auto !important;
    }
}

/* semi-transparent page overlay when sidebar is open on mobile */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1005;
}

    .overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

/* logo slot at the very top */
#sidebar .logo-container {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 16px;
    border-bottom: 1px solid var(--aw-divider);
    background: #0f2f3e; /* keep white mark readable on teal */
}

/* section that hosts the company filter */
.sidebar-company-filter-container {
    padding: .9rem;
    border-bottom: 1px solid var(--aw-divider);
}

.sidebar-company-filter .form-select {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
    font-size: .9rem;
}

    .sidebar-company-filter .form-select:focus {
        background-color: rgba(255,255,255,0.18);
        color: #fff;
    }

/* nav list */
#sidebar .nav {
    padding: .5rem .25rem 2rem;
}

    #sidebar .nav .nav-item {
        margin: .125rem .25rem;
    }

    #sidebar .nav .nav-link {
        display: flex;
        align-items: center;
        gap: .625rem;
        color: var(--aw-muted);
        padding: .6rem .9rem;
        border-radius: 10px;
        text-decoration: none;
        transition: background .15s ease, color .15s ease;
    }

        #sidebar .nav .nav-link i {
            width: 18px;
            text-align: center;
            font-size: .95rem;
        }

        /* hover/active with gold background and dark green text */
        #sidebar .nav .nav-item .nav-link:hover,
        #sidebar .nav .nav-link:hover {
            background: #FBB03B;
            color: #0b3a23;
        }

            #sidebar .nav .nav-item .nav-link:hover i,
            #sidebar .nav .nav-link:hover i {
                color: #0b3a23;
            }

        #sidebar .nav .nav-item .nav-link.active,
        #sidebar .nav .nav-link.active,
        #sidebar .nav .nav-item .nav-link[aria-current="page"],
        #sidebar .nav .nav-link[aria-current="page"] {
            background: #FBB03B;
            color: #0b3a23;
            box-shadow: none;
        }

            #sidebar .nav .nav-item .nav-link.active i,
            #sidebar .nav .nav-link.active i,
            #sidebar .nav .nav-item .nav-link[aria-current="page"] i,
            #sidebar .nav .nav-link[aria-current="page"] i {
                color: #0b3a23;
            }

    /* tiny “New” badges that appear in menu */
    #sidebar .nav .badge {
        margin-left: .4rem;
        background: var(--aw-green-500);
        color: #0b3a23;
        font-weight: 600;
        border-radius: 9px;
    }

/* nested admin section divider */
#sidebar .admin-section {
    margin-top: .25rem;
    padding-top: .5rem;
    border-top: 1px solid var(--aw-divider);
}

#sidebar .admin-section-title {
    color: #fff;
    font-weight: 600;
    padding: .7rem .9rem;
    cursor: pointer;
}

#sidebar .admin-section .nav .nav-link {
    padding: .5rem .9rem .5rem 1.9rem; /* indent */
}

/* =========================================
   HEADER (top bar) – height 64px, color #003145
   ========================================= */
.app-header,
.navbar.aw-topbar {
    background: var(--aw-topbar) !important;
    height: 64px;
    box-shadow: var(--aw-shadow);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

    .navbar.aw-topbar .container-fluid {
        height: 64px;
    }

/* left: burger button styled as ghost */
.aw-topbar #sidebarCollapse.btn,
#sidebarCollapse.btn {
    color: #fff;
    background: transparent !important;
    border: 1px solid rgba(255,255,255,.3);
    padding: .35rem .55rem;
    border-radius: 10px;
}

    .aw-topbar #sidebarCollapse.btn:hover,
    #sidebarCollapse.btn:hover {
        background: rgba(255,255,255,.08) !important;
        border-color: rgba(255,255,255,.5);
    }

    .aw-topbar #sidebarCollapse.btn:focus,
    #sidebarCollapse.btn:focus {
        box-shadow: 0 0 0 0.2rem rgba(255,255,255,.15) !important;
        background: transparent !important;
    }

/* brand area (keeps logo crisp) */
.aw-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    text-decoration: none;
}

/* center: “trending” pill group */
.aw-news {
    display: flex;
    align-items: center;
    gap: .6rem;
    height: 40px;
    padding: 0 .6rem 0 0;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

    .aw-news .tag {
        background: var(--aw-gold-500);
        color: #2a1e00;
        height: 40px;
        line-height: 40px;
        padding: 0 .9rem;
        border-radius: 999px;
        font-weight: 700;
        font-size: .9rem;
    }

    .aw-news .text {
        color: var(--aw-white);
        opacity: .85;
        font-size: .9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: min(48vw,820px);
    }

/* right: user chip + icons cluster */
.aw-user {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.aw-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    padding: .35rem .6rem;
    border-radius: 999px;
    color: #fff;
}

    .aw-chip .avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        background: #fff;
    }

    .aw-chip .role {
        font-size: .75rem;
        opacity: .75;
    }

.aw-icon {
    color: #fff;
    opacity: .85;
}

    .aw-icon:hover {
        opacity: 1;
    }

/* make the default bootstrap light navbar look like our topbar */
.navbar.navbar-light.bg-white.box-shadow {
    background: var(--aw-topbar) !important;
    box-shadow: var(--aw-shadow);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.navbar.navbar-light .nav-link,
.navbar.navbar-light .navbar-brand,
.navbar.navbar-light .navbar-text {
    color: #fff !important;
}

/* =========================================
   CONTENT WRAPPER
   Uses flexbox — no manual margin needed
   ========================================= */
.main-content {
    flex: 1 1 auto; /* fills remaining space in flex container */
    margin-left: 0 !important; /* flexbox handles spacing */
}

.main-content > .container-fluid {
    padding: 1.25rem 15px;
}

/* On mobile, content stays full width (sidebar is fixed off-canvas) */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0 !important;
    }
}

/* =========================================
   UTILITIES used by the new theme (optional)
   ========================================= */
.text-muted-on-dark {
    color: var(--aw-muted) !important;
}

.border-on-dark {
    border-color: var(--aw-divider) !important;
}

/* Footer small print */
.footer.text-muted {
    color: #5e6b75 !important;
}


/* Tighten the seam between sidebar and content if needed */
.d-flex > #sidebar + .main-content {
    padding-left: 0;
}


/* ===== Sidebar brand slot ===== */
:root {
    /* rail/brand color from the UI spec */
    --aw-rail: #1A4E63;
}

/* Sidebar background (if not already set) */
#sidebar {
    background: var(--aw-rail);
}

/* Top logo strip — same color as the rail, fixed height, center aligned */
.logo-container {
    background: var(--aw-rail) !important; /* override the bg-white utility */
    height: 64px; /* matches header height in spec */
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden; /* no popping out */
    box-shadow: 0 2px 9px rgba(0,0,0,.18); /* subtle depth like design */
}

    /* Make the logo scale nicely inside the strip */
    .logo-container img {
        display: block;
        max-height: 44px; /* fits within the 64px strip with padding */
        max-width: 100%;
        height: auto;
        width: auto;
        object-fit: contain;
    }

/* Mobile tweaks */
@media (max-width: 991.98px) {
    .logo-container {
        height: 56px;
        padding: 8px 12px;
    }

        .logo-container img {
            max-height: 36px;
        }
}

/* =====================================================
   SIDEBAR LINK TYPOGRAPHY  
   Font: Poppins Medium, 15px, 3% tracking, Title Case
   ===================================================== */


#sidebar {
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

    /* Sidebar link text */
    #sidebar .nav .nav-link {
        font-weight: 500; /* Medium */
        font-size: 14px;
        line-height: 1.2; /* 100% in but small padding in UI */
        letter-spacing: 0.02em; /* 3% tracking */
        text-transform: none; /* Title Case */
        color: #ffffff;
        opacity: 0.85; /* soft default contrast */
        transition: opacity 0.2s ease, background 0.2s ease;
    }

        /* Hover and active states */
        #sidebar .nav .nav-link:hover {
            opacity: 1;
            color: #ffffff;
            background-color: rgba(255, 255, 255, 0.08);
        }

        #sidebar .nav .nav-link.active,
        #sidebar .nav .nav-link[aria-current="page"] {
            opacity: 1;
            color: #ffffff;
            background-color: rgba(255, 255, 255, 0.14);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
        }

        /* Sidebar icons spacing (to align perfectly with text) */
        #sidebar .nav .nav-link i {
            font-size: 14px;
            margin-right: 10px;
            width: 18px;
            text-align: center;
            color: rgba(255,255,255,0.85);
        }

        /* Hover glow for icons */
        #sidebar .nav .nav-link:hover i {
            color: #ffffff;
        }

    /* Better vertical rhythm between links */
    #sidebar .nav-item {
        margin: 3px 0;
    }

/* =========================================
   CARD HEADERS — Lighter, Neutral Container Style
   Creates visual hierarchy: Card (container) → Table (data)
   ========================================= */

/* Base card header style - distinctive with accent border */
.card-header {
    background: linear-gradient(to right, #E8F4F8 0%, #F9FBFC 100%) !important; /* Subtle gradient */
    color: #1A4E63 !important; /* Dark teal from palette */
    font-weight: 600;
    font-size: 16px;
    padding: 0.9rem 1.25rem;
    border-left: 4px solid #058586 !important; /* Accent teal stripe */
    border-bottom: 2px solid #D4E9EE;
    border-radius: 8px 8px 0 0; /* Rounded top corners */
    box-shadow: 0 1px 2px rgba(5, 133, 134, 0.08); /* Subtle teal shadow */
    transition: all 0.2s ease-in-out;
}

    .card-header h1,
    .card-header h2,
    .card-header h3,
    .card-header h4,
    .card-header h5,
    .card-header h6 {
        color: #1A4E63 !important; /* Dark teal */
        margin: 0;
        font-weight: 600;
    }

    .card-header i {
        color: #058586 !important; /* Accent teal for icons */
        margin-right: 0.5rem;
        font-size: 1.1em; /* Slightly larger icons */
    }

    /* Ensure buttons inside card headers keep their own icon color */
    .card-header .btn-aw i,
    .card-header .btn i {
        color: inherit !important;
    }

/* Override old Bootstrap color classes in card headers */
.card-header.bg-dark,
.card-header.bg-primary,
.card-header.bg-info,
.card-header.bg-secondary,
.card-header.bg-success,
.card-header.bg-warning,
.card-header.bg-danger {
    background: linear-gradient(to right, #E8F4F8 0%, #F9FBFC 100%) !important;
    color: #1A4E63 !important; /* Dark teal */
    border-left: 4px solid #058586 !important; /* Keep accent stripe */
}

    .card-header.bg-dark *,
    .card-header.bg-primary *,
    .card-header.bg-info *,
    .card-header.bg-secondary *,
    .card-header.bg-success *,
    .card-header.bg-warning *,
    .card-header.bg-danger * {
        color: #1A4E63 !important;
    }

/* Card header hover effect */
.card-header:hover {
    background: linear-gradient(to right, #D4E9EE 0%, #EEF6F9 100%) !important;
    border-left-color: #1A4E63 !important; /* Darker teal on hover */
    box-shadow: 0 2px 4px rgba(5, 133, 134, 0.12); /* Stronger shadow */
}

/* Remove conflicting text-white classes */
.card-header.text-white,
.card-header .text-white {
    color: #1A4E63 !important; /* Dark teal */
}

/* Card body styling for consistency */
.card {
    border: 1px solid #E1E8EB; /* Subtle border */
    box-shadow: 0px 2px 8px rgba(26, 78, 99, 0.08); /* Softer shadow with brand color */
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem; /* Breathing room between cards */
    background: #FFFFFF; /* Pure white background */
}

.card-body {
    padding: 1.25rem;
    background: #FFFFFF; /* Ensure white body */
}

/* Optional: Add slight elevation on card hover */
/* COMMENTED OUT - transform creates containing block that breaks dropdown positioning */
/*
.card:hover {
    box-shadow: 0px 4px 12px rgba(26, 78, 99, 0.12);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}
*/

/* =========================================
   METRIC CARDS (Dashboard KPI tiles)
   ========================================= */
#metrics-root .card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: #FFFFFF;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#metrics-root .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#metrics-root .card-body {
    padding: 1.5rem 1.25rem;
}

#metrics-root .card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    margin-bottom: 0.75rem;
    text-transform: none;
}

#metrics-root .card-text {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1A4E63;
    margin: 0;
    line-height: 1.2;
}

/* Colored bottom borders for each metric card */
#metrics-root > div:nth-child(1) .card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #1A4E63;
}

#metrics-root > div:nth-child(2) .card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #058586;
}

#metrics-root > div:nth-child(3) .card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #6EB17E;
}

#metrics-root > div:nth-child(4) .card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #FBB03B;
}

#metrics-root > div:nth-child(5) .card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #FC5B3F;
}

/* Responsive adjustments for metric cards */
@media (max-width: 767.98px) {
    #metrics-root .card-text {
        font-size: 1.5rem;
    }
    
    #metrics-root .card-body {
        padding: 1rem;
    }
}

/* ===== Layout safety (site-wide, theme-friendly) ===== */

/* Flex/grid children shouldn't force overflow */
.row > * {
    min-width: 0;
}

/* Content must never exceed viewport width */
.main-content,
.main-content .container-fluid {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Charts should maintain aspect ratio and not be forced to stretch */
.chart-container {
    position: relative;
    width: 100%;
    height: auto;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
}

/* ===== Centralized Layout System ===== */
/* Table page layout classes - only affects pages using aw-container */

.aw-container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.aw-title-info h1 {
    margin: 0;   
}

.aw-header-action {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Table-specific container body variant */
.aw-container-card-body--table {
    padding: 0 !important;
}

.aw-container-card-body--table .table-responsive {
    padding: 0;
    margin: 0;
}

/* Filter form layout */
.date-filter-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.date-filter-form .form-group {
    min-width: 150px;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
}

.date-filter-form .form-control {
    min-height: 44px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.date-filter-form .form-group > label:first-child {
    margin-bottom: 0.5rem;
}

.date-filter-form .form-group > input[type="hidden"] + button {
    margin-top: 1.78rem !important;
    margin-bottom: 1.78rem !important;
}

.date-filter-form .form-group > button:first-child:not([type="hidden"]) {
    margin-top: 1.78rem !important;
    margin-bottom: 1.78rem !important;
}

.date-filter-form .form-group.ms-auto {
    display: flex;
    gap: 0.5rem;
    flex-direction: row;
    align-items: center;
    padding-top: 1.78rem !important;
    padding-bottom: 1.78rem !important;
    justify-content: flex-end;
}

/* Card component */
.aw-container-card {
    border: 1px solid #E1E8EB;
    box-shadow: 0px 2px 8px rgba(26, 78, 99, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: #FFFFFF;
}

.aw-container-card-body {
    padding: 1.25rem;
    background: #FFFFFF;
}

/* Utility class - used throughout application */
.p-0 {
    padding: 0 !important;
}
