@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;500&display=swap');

/* -----------------------------------------------------------------------------
   swayamvar Admin Design System (Light & Dark)
   ----------------------------------------------------------------------------- */

body {
    font-family: 'Inter', sans-serif !important;
}

.font-monospace {
    font-family: 'Roboto Mono', monospace !important;
}

/* Root Variables - Light Mode */
:root,
[data-bs-theme="light"] {
    --swayamvar-primary: #C2185B;
    --swayamvar-primary-rgb: 194, 24, 91;
    --swayamvar-primary-dark: #880E4F;
    --swayamvar-primary-light: #fce4ec;

    /* Add PascalCase aliases for consistency with CSHTML */
    --Swayamvar-primary: var(--swayamvar-primary);
    --Swayamvar-primary-rgb: var(--swayamvar-primary-rgb);
    --Swayamvar-primary-dark: var(--swayamvar-primary-dark);
    --Swayamvar-primary-light: var(--swayamvar-primary-light);

    --bs-primary: var(--swayamvar-primary);
    --bs-primary-rgb: var(--swayamvar-primary-rgb);
    --bs-primary-text-emphasis: var(--swayamvar-primary-dark);
    --bs-primary-bg-subtle: var(--swayamvar-primary-light);
    --bs-primary-border-subtle: #f8bbd0;
    --bs-link-color: var(--swayamvar-primary);
    --bs-link-hover-color: var(--swayamvar-primary-dark);
}

/* Root Variables - Dark Mode Overrides */
[data-bs-theme="dark"] {
    --swayamvar-primary: #ec407a;
    /* Lighter pink for dark mode visibility */
    --swayamvar-primary-rgb: 236, 64, 122;
    --swayamvar-primary-dark: #f06292;
    --swayamvar-primary-light: rgba(236, 64, 122, 0.1);

    --Swayamvar-primary: var(--swayamvar-primary);
    --Swayamvar-primary-rgb: var(--swayamvar-primary-rgb);
    --Swayamvar-primary-dark: var(--swayamvar-primary-dark);
    --Swayamvar-primary-light: var(--swayamvar-primary-light);

    --bs-primary: var(--swayamvar-primary);
    --bs-primary-rgb: var(--swayamvar-primary-rgb);
    --bs-body-bg: #1a1d21;
    --bs-body-color: #ced4da;
    --bs-heading-color: #f0f2f5;

    background-color: #1a1d21 !important;
}

/* --- Dark Mode Surface Specifics --- */
[data-bs-theme="dark"] body {
    background-color: #0c0e12 !important;
    /* Deeper dark for body */
    color: #ced4da;
}

/* Page Title & Breadcrumb Alignment (Silva Pattern) */
.fs-18 {
    font-size: 18px !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.breadcrumb-item a {
    color: var(--bs-secondary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--swayamvar-primary);
    font-weight: 600;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "/";
    color: #ced4da;
}

[data-bs-theme="dark"] .content-page {
    background-color: #0c0e12 !important;
}

[data-bs-theme="light"] .content-page {
    background-color: #f4f7f6;
    /* Subtle off-white/gray for depth */
}

[data-bs-theme="light"] body {
    background-color: #f4f7f6 !important;
}

[data-bs-theme="dark"] .card {
    background-color: #22252a !important;
    border-color: #2f333a !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #22252a !important;
    border-bottom: 1px solid #2f333a !important;
}

[data-bs-theme="dark"] .footer {
    background-color: #22252a !important;
    border-top: 1px solid #2f333a !important;
    color: #ced4da !important;
}

[data-bs-theme="dark"] .topbar-custom {
    background-color: #22252a !important;
    border-bottom: 1px solid #2f333a !important;
}

[data-bs-theme="dark"] .app-sidebar-menu {
    background-color: #22252a !important;
    border-right: 1px solid #2f333a !important;
}

[data-bs-theme="dark"] .logo-box {
    background-color: #22252a !important;
    border-bottom: 1px solid #2f333a !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #22252a !important;
    color: #ced4da !important;
}

/* --- Sidebar Branding & Menu --- */
.logo-box {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.swayamvar-logo-text,
.Swayamvar-logo-text {
    color: var(--Swayamvar-primary) !important;
    letter-spacing: 1px;
}

.fs-10 {
    font-size: 10px !important;
}

.line-height-1 {
    line-height: 1.1 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 70px;
}

.mt-n2 {
    margin-top: -4px !important;
}

.tp-link.active {
    color: var(--swayamvar-primary) !important;
}

[data-bs-theme="dark"] .logo-box {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#side-menu li.menu-title {
    color: #adb5bd !important;
    /* Muted silver-gray */
    opacity: 1;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1.2px;
    padding: 20px 20px 8px 20px;
}

#side-menu li a {
    color: #344050;
    /* Slightly darker for unselected items */
    transition: all 0.2s ease;
}

#side-menu li a:hover {
    color: var(--swayamvar-primary) !important;
}

/* Parent items with submenus: Only highlight text/icon when expanded */
#sidebar-menu #side-menu li a[data-bs-toggle="collapse"]:not(.collapsed),
#sidebar-menu #side-menu li a[aria-expanded="true"] {
    background-color: transparent !important;
    color: var(--swayamvar-primary) !important;
}

/* Parent items should look NORMAL when closed */
#sidebar-menu #side-menu li a[data-bs-toggle="collapse"].collapsed,
#sidebar-menu #side-menu li a[aria-expanded="false"] {
    color: #344050 !important;
}

/* Ensure the background box ONLY appears on leaf nodes or active sub-items */
#side-menu li>a.active:not([data-bs-toggle="collapse"]),
#sidebar-menu .nav-second-level li a.active {
    color: var(--swayamvar-primary) !important;
    background-color: var(--swayamvar-primary-light) !important;
    border-radius: 8px;
}

#side-menu li a i {
    transition: all 0.2s ease;
    color: #6c757d;
}

#side-menu li a.active i,
#side-menu li a[aria-expanded="true"] i,
#side-menu li a:hover i {
    color: var(--swayamvar-primary) !important;
}

/* --- Form & Table Overrides for Theme Consistency --- */
.btn-primary {
    --bs-btn-bg: var(--swayamvar-primary);
    --bs-btn-border-color: var(--swayamvar-primary);
    --bs-btn-hover-bg: var(--swayamvar-primary-dark);
    --bs-btn-hover-border-color: var(--swayamvar-primary-dark);
    --bs-btn-active-bg: var(--swayamvar-primary-dark);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #22252a !important;
    border-color: #2f333a !important;
    color: #ced4da !important;
}

[data-bs-theme="dark"] .table {
    color: #ced4da;
    border-color: #2f333a;
}

/* --- Topbar Toggle & Navigation --- */
.button-toggle-menu {
    border: none;
    background: transparent;
    height: 70px;
    line-height: 70px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: 24px;
    color: #344050;
    transition: all 0.2s ease;
}

.button-toggle-menu:hover {
    color: var(--swayamvar-primary);
}

.button-toggle-menu svg {
    height: 20px;
    width: 20px;
}

[data-bs-theme="dark"] .button-toggle-menu {
    color: #ced4da;
}

/* --- Smooth Transitions for Theme Switching --- */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card,
.topbar-custom,
.app-sidebar-menu,
.footer {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}



/* --- Polished Search Bar & Input Components --- */
.search-polished {
    display: flex;
    align-items: center;
    background: #f1f3fa;
    border-radius: 8px;
    padding: 0 12px;
    height: 38px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid transparent;
}

.search-polished:focus-within {
    background: #fff;
    border-color: var(--swayamvar-primary);
    box-shadow: 0 0 0 3px rgba(var(--swayamvar-primary-rgb), 0.15);
}

.search-polished i, 
.search-polished svg {
    color: #98a6ad;
    margin-right: 12px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.search-polished:focus-within i,
.search-polished:focus-within svg {
    color: var(--swayamvar-primary);
}

.search-polished i { font-size: 18px; line-height: 1; }
.search-polished svg { width: 16px; height: 16px; }

.search-polished input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    font-size: 0.875rem;
    font-weight: 500;
    width: 100%;
    color: #344050;
    padding: 0 !important;
    min-width: 180px;
    box-shadow: none !important;
    height: 100%;
}

.search-polished input::placeholder {
    color: #adb5bd;
    font-weight: 400;
}


[data-bs-theme="dark"] .search-polished {
    background: #2b2b40;
    border-color: #32324d;
}

[data-bs-theme="dark"] .search-polished:focus-within {
    background: #1e1e2d;
}

[data-bs-theme="dark"] .search-polished input {
    color: #ced4da;
}

/* --- DataTables Polished Overrides --- */
.dataTables_filter input {
    background-color: #f1f3fa;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: .35rem .75rem .35rem 2.25rem !important;
    font-size: .8125rem;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .65rem center;
    width: 280px !important;
    color: #495057;
}

.dataTables_filter input:focus {
    background-color: #fff;
    border-color: var(--swayamvar-primary);
    box-shadow: none;
    outline: none;
}

.dataTables_filter label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
}

[data-bs-theme="dark"] .dataTables_filter input {
    background-color: #2b2b40;
    color: #adb5bd;
    border-color: #32324d;
}

[data-bs-theme="dark"] .dataTables_filter input:focus {
    background-color: #1e1e2d;
}

[data-bs-theme="dark"] .dataTables_filter label {
    color: #92929f;
}

/* Silva Theme DataTables Overrides */
.dataTables_wrapper .row:first-child {
    margin-bottom: 24px !important;
    align-items: center;
}

/* Page Length Select - Match Silva form-select-sm */
.dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: .25rem;
    padding: .25rem 2rem .25rem .5rem !important;
    font-size: .765625rem;
    height: auto !important;
    min-width: 65px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right .665rem center !important;
    background-size: 12px 10px !important;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

[data-bs-theme="dark"] .dataTables_length select {
    background-color: #2b2b40;
    border-color: #32324d;
    color: #ced4da;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23adb5bd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

/* Sorting Icons - Match Silva Style */
table.dataTable>thead .sorting, 
table.dataTable>thead .sorting_asc, 
table.dataTable>thead .sorting_desc {
    background-image: none !important;
    position: relative;
    cursor: pointer;
}

table.dataTable>thead .sorting:before, 
table.dataTable>thead .sorting:after, 
table.dataTable>thead .sorting_asc:before, 
table.dataTable>thead .sorting_asc:after, 
table.dataTable>thead .sorting_desc:before, 
table.dataTable>thead .sorting_desc:after {
    position: absolute;
    bottom: .6rem;
    display: block;
    opacity: .3;
    font-family: inherit !important;
    font-size: 0.9rem;
    color: inherit;
}

table.dataTable>thead .sorting:before, 
table.dataTable>thead .sorting_asc:before, 
table.dataTable>thead .sorting_desc:before {
    right: 14px;
    content: "\2191";
}

table.dataTable>thead .sorting:after, 
table.dataTable>thead .sorting_asc:after, 
table.dataTable>thead .sorting_desc:after {
    right: 7px;
    content: "\2193";
}

table.dataTable>thead .sorting_asc:before, 
table.dataTable>thead .sorting_desc:after {
    opacity: 1;
    color: var(--swayamvar-primary) !important;
}

.table.dataTable thead th {
    padding-right: 30px !important;
    vertical-align: middle;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #7a7a7a;
    border-bottom: 1.5px solid #f1f3fa !important;
}

[data-bs-theme="dark"] .table.dataTable thead th {
    border-bottom-color: #2f333a !important;
    color: #abb4be;
}

/* Table Row Polish */
.table tbody td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f3fa;
    padding: 12px 10px !important;
}

[data-bs-theme="dark"] .table tbody td {
    border-bottom-color: #2f333a;
}

/* -----------------------------------------------------------------------------
   Checkbox Vertical & Horizontal Alignment Standard
   Ensures the first column (bulk selection) is narrow, centered, and precise.
   ----------------------------------------------------------------------------- */
.table.dataTable thead th:first-child,
.table.dataTable tbody td:first-child {
    padding: 0 !important;
    width: 30px !important;
    max-width: 30px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.table.dataTable thead th:first-child .d-flex,
.table.dataTable tbody td:first-child .d-flex {
    width: 30px !important;
    justify-content: center !important;
}

