@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

:root {
    --primary: #b66dff;
    --primary-dark: #a25ede;
    --secondary: #c7c7c7;
    --success: #1bcfb4;
    --info: #198ae3;
    --warning: #fed713;
    --danger: #fe7c96;
    --light: #f8f9fa;
    --dark: #3e4b5b;
    --bg-body: #f2edf3;
    --card-bg: #ffffff;
    --sidebar-width: 260px;
    --navbar-height: 70px;
}

body {
    background-color: var(--bg-body);
    font-family: 'Ubuntu', sans-serif;
    color: #343a40;
    margin: 0;
    padding: 0;
}

/* Layout Structure */
.container-scroller {
    overflow: hidden;
}

.page-body-wrapper {
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    flex-direction: row;
    padding-left: 0;
    padding-right: 0;
    padding-top: var(--navbar-height);
}

/* Sidebar */
.sidebar {
    min-height: calc(100vh - var(--navbar-height));
    background: #ffffff;
    font-weight: 500;
    padding: 0;
    width: var(--sidebar-width);
    z-index: 11;
    transition: width 0.25s ease, background 0.25s ease;
    -webkit-transition: width 0.25s ease, background 0.25s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    position: fixed;
    height: 100%;
}

.sidebar .nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    flex-direction: column;
}

.sidebar .nav .nav-item {
    margin-bottom: 0;
}

.sidebar .nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 1.125rem 2rem 1.125rem 2rem;
    color: #3e4b5b;
    transition-duration: 0.45s;
    transition-property: color;
    font-size: 0.9375rem;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.sidebar .nav .nav-item.active>.nav-link,
.sidebar .nav .nav-item:hover>.nav-link {
    color: var(--primary);
    background-color: #fcfcfc;
    border-left-color: var(--primary);
}

.sidebar .nav .nav-item .nav-link i {
    margin-right: 1.25rem;
    font-size: 1.125rem;
    color: #bba8bff5;
}

.sidebar .nav .nav-item.active .nav-link i,
.sidebar .nav .nav-item:hover .nav-link i {
    color: var(--primary);
}

.sidebar .nav .nav-item.nav-profile .nav-link {
    display: flex;
    flex-direction: row;
    /* Changed to row for profile image + text */
    align-items: center;
}

/* Navbar */
.navbar {
    transition: background 0.25s ease;
    -webkit-transition: background 0.25s ease;
    font-weight: 400;
    background: #ffffff;
    box-shadow: 0 4px 16px 0 rgba(167, 175, 183, 0.33);
    z-index: 1030;
    height: var(--navbar-height);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.navbar-brand {
    color: var(--primary) !important;
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 2rem;
}

/* Main Content */
.main-panel {
    transition: width 0.25s ease, margin 0.25s ease;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    /* Offset for fixed sidebar */
}

.content-wrapper {
    background: var(--bg-body);
    padding: 2.75rem 2.25rem;
    width: 100%;
    flex-grow: 1;
}

/* Card Styling */
.card {
    border: 0;
    background: var(--card-bg);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
}

.card .card-title {
    color: #343a40;
    margin-bottom: 1.5rem;
    text-transform: capitalize;
    font-size: 1.125rem;
    font-weight: 600;
    display: block;
}

.card-body {
    padding: 2.5rem 2.5rem;
}

/* Gradients */
.bg-gradient-primary {
    background: linear-gradient(to right, #da8cff, #9a55ff) !important;
    color: white;
}

.bg-gradient-danger {
    background: linear-gradient(to right, #ffbf96, #fe7096) !important;
    color: white;
}

.bg-gradient-info {
    background: linear-gradient(to right, #90caf9, #047edf 99%) !important;
    color: white;
}

.bg-gradient-success {
    background: linear-gradient(to right, #84d9d2, #07cdae) !important;
    color: white;
}

/* Dash specific overrides */
/* Hide default Dash Tab Headers if we use Sidebar */
.hidden-tabs .nav-tabs,
.hidden-tabs .nav {
    display: none !important;
}

/* Gradient Buttons */
.btn-gradient-primary {
    background: linear-gradient(to right, #da8cff, #9a55ff) !important;
    border: 0 !important;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
    color: white !important;
    border-radius: 5px !important;
    font-weight: 500;
}

.btn-gradient-primary:hover {
    opacity: 0.8 !important;
    color: white !important;
}

/* Custom Checkbox */
.custom-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #b66dff;
}

/* Fix for Dash Bootstrap Components which might wrap tabs differently */
/* Fix for Dash Bootstrap Components which might wrap tabs differently */
#tabs .nav-tabs {
    display: none !important;
}

#tabs .nav-link {
    display: none !important;
}

#tabs .nav-link.active {
    color: white !important;
    background-color: #b66dff !important;
    box-shadow: 0 4px 6px rgba(182, 109, 255, 0.3) !important;
}

#tabs .nav-link:hover:not(.active) {
    background-color: #f2edf3 !important;
    color: #b66dff !important;
}

/* ---------------------------------------------------------
   Form Controls Override (Dropdowns, Inputs)
   Targeting React-Select default classes used by dcc.Dropdown
--------------------------------------------------------- */
.Select-control {
    border: 1px solid #ebedf2 !important;
    border-radius: 4px !important;
    height: 40px !important;
    font-family: 'Ubuntu', sans-serif !important;
    font-size: 0.8125rem !important;
}

.Select-placeholder,
.Select--single>.Select-control .Select-value {
    line-height: 40px !important;
    padding-left: 15px !important;
}

.Select-menu-outer {
    border-color: #ebedf2 !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05) !important;
}

.Select-option.is-selected {
    background-color: #b66dff !important;
    color: white !important;
}

.Select-option.is-focused:not(.is-selected) {
    background-color: #f2edf3 !important;
    color: #343a40 !important;
}

/* ---------------------------------------------------------
   Slider Override
   Targeting rc-slider classes used by dcc.Slider
--------------------------------------------------------- */
.rc-slider-track {
    background-color: #b66dff !important;
}

.rc-slider-handle {
    border: solid 2px #b66dff !important;
    background-color: white !important;
    opacity: 1 !important;
    box-shadow: none !important;
}

.rc-slider-handle:hover,
.rc-slider-handle:active {
    border-color: #a25ede !important;
    box-shadow: 0 0 5px #b66dff !important;
}

.rc-slider-dot-active {
    border-color: #b66dff !important;
}

/* ---------------------------------------------------------
   Aggressive Table Styling
   Targeting the deep dash-table structure to override inline styles
--------------------------------------------------------- */
/* ---------------------------------------------------------
   Aggressive Table Styling
   Targeting the deep dash-table structure to override inline styles
--------------------------------------------------------- */
.dash-table-container {
    font-family: 'Ubuntu', sans-serif !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    /* Soft Card Shadow */
    border-radius: 8px;
    /* Rounded Corners */
    overflow: hidden;
    /* Clip inner content */
    margin-top: 15px;
    /* Spacing from filters */
    background-color: white;
    /* Ensure white background behind table */
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
    background-color: #b66dff !important;
    /* Bold Purple Admin Background */
    color: white !important;
    /* White Text */
    font-weight: bold !important;
    font-size: 0.85rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 2px solid #eaddff !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding: 20px 15px !important;
    font-family: 'Ubuntu', sans-serif !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
    background-color: white !important;
    color: #555 !important;
    border-bottom: 1px solid #f2edf3 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding: 20px 15px !important;
    /* More padding */
    font-size: 0.95rem !important;
    font-family: 'Ubuntu', sans-serif !important;
    vertical-align: middle !important;
    transition: background-color 0.2s ease;
}

/* Row Hover Effect */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
    background-color: #f8fcfd !important;
    /* Extremely Light Blue/Green Tint on hover */
    color: #000 !important;
}

/* Metric Card Overrides for Dashboard */
.metric-card {
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    text-align: left;
    /* Align left for admin dashboard look */
    border: 0;
    /* Remove border for gradient cards */
    transition: transform 0.2s;
    color: white;
    /* Default text to white for gradient cards */
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-3px);
}

.metric-card h3 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
    /* Ensure title is white on gradients */
}

/* ---------------------------------------------------------
   Form Controls Override (Dropdowns, Inputs)
   Targeting React-Select default classes used by dcc.Dropdown
--------------------------------------------------------- */
.Select-control {
    border: 1px solid #d8d8d8 !important;
    /* Slightly darker border */
    border-radius: 6px !important;
    height: 45px !important;
    /* Taller touch targets */
    font-family: 'Ubuntu', sans-serif !important;
    font-size: 0.9rem !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.Select-control:hover {
    border-color: #b66dff !important;
}

.Select-placeholder,
.Select--single>.Select-control .Select-value {
    line-height: 45px !important;
    padding-left: 15px !important;
    color: #343a40 !important;
}

.Select-arrow-zone {
    padding-right: 10px;
}

.Select-arrow {
    border-color: #b66dff transparent transparent !important;
    /* Purple Arrow */
    border-width: 6px 6px 3px !important;
}

.Select-menu-outer {
    border: none !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 0 6px 6px !important;
    margin-top: 2px !important;
}

.metric-card p {
    color: rgba(255, 255, 255, 0.8);
    /* Semi-transparent white */
    margin-bottom: 0;
    font-size: 1.1rem;
}

/* Decorative circle for cards */
.metric-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    transform: skewX(-20deg) translateX(40px);
    pointer-events: none;
}

/* Header */
.header h1 {
    color: #343a40;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.header p {
    color: #9c9fa6;
}

/* Metrics Container Flex */
.metrics-container {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.metric-card {
    flex: 1;
}

/* Status Messages */
.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

/* Charts */
.chart-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    /* Soft Card Shadow */
    margin-bottom: 25px;
}

/* Filters Toolbar */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.03);
    /* Subtle shadow for the toolbar */
    align-items: flex-end;
    /* Align labels and inputs */
}

.filter-item {
    flex: 1;
    min-width: 200px;
    /* Ensure filters don't get too squished */
}


.filter-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #343a40;
    font-size: 0.9rem;
}

.filter-input {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    border: 1px solid #d7c8f2;
    border-radius: 6px;
    background-color: #ffffff;
    color: #343a40;
    font-size: 0.95rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-input:focus {
    border-color: #b66dff;
    box-shadow: 0 0 0 3px rgba(182, 109, 255, 0.2);
    outline: none;
}

/* Settings Items */
.setting-item {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}