/**
 * Modern UI v5 - Bootstrap 5.3 Enhancement Layer
 * Visual refresh for the BS5 migration release
 */

/* === GLOBAL TRANSITIONS === */
.card,
.btn,
.form-control,
.form-select,
.list-group-item,
.badge,
.alert,
.nav-link {
    transition: all 0.15s ease-in-out;
}

/* === CARDS === */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* === BUTTONS === */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-sm {
    border-radius: 0.375rem;
}

.btn-lg {
    border-radius: 0.625rem;
}

/* Outline buttons get subtle background on hover */
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* === FORM CONTROLS === */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border-color: #dee2e6;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-control-xs,
.form-select-xs {
    border-radius: 0.25rem;
}

.form-control-sm,
.form-select-sm {
    border-radius: 0.375rem;
}

.form-control-lg,
.form-select-lg {
    border-radius: 0.625rem;
}

/* === INPUT GROUPS === */
.input-group > .form-control:first-child,
.input-group > .form-select:first-child,
.input-group > .btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.input-group > .form-control:last-child,
.input-group > .form-select:last-child,
.input-group > .btn:last-child,
.input-group > .input-group-text:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.input-group > .input-group-text:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.input-group-text {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* Large input groups */
.input-group-lg > .form-control:first-child,
.input-group-lg > .btn:first-child {
    border-top-left-radius: 0.625rem;
    border-bottom-left-radius: 0.625rem;
}

.input-group-lg > .form-control:last-child,
.input-group-lg > .btn:last-child,
.input-group-lg > .input-group-text:last-child {
    border-top-right-radius: 0.625rem;
    border-bottom-right-radius: 0.625rem;
}

.input-group-lg > .input-group-text:first-child {
    border-top-left-radius: 0.625rem;
    border-bottom-left-radius: 0.625rem;
}

/* Small input groups */
.input-group-sm > .form-control:first-child,
.input-group-sm > .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.input-group-sm > .form-control:last-child,
.input-group-sm > .btn:last-child,
.input-group-sm > .input-group-text:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

.input-group-sm > .input-group-text:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* Extra small input groups */
.input-group-xs > .form-control:first-child,
.input-group-xs > .btn:first-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.input-group-xs > .form-control:last-child,
.input-group-xs > .btn:last-child,
.input-group-xs > .input-group-text:last-child {
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
}

.input-group-xs > .input-group-text:first-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

/* === LIST GROUPS === */
.list-group {
    border-radius: 0.75rem;
    overflow: hidden;
}

.list-group-item {
    border-left: none;
    border-right: none;
    border-color: rgba(0, 0, 0, 0.06);
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item.active {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.list-group-item-action:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* === BADGES === */
.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
    border-radius: 0.375rem;
}

.badge.rounded-pill {
    border-radius: 50rem;
}

/* === ALERTS === */
.alert {
    border: none;
    border-radius: 0.75rem;
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: var(--bs-primary);
}

.alert-success {
    border-left-color: var(--bs-success);
}

.alert-danger {
    border-left-color: var(--bs-danger);
}

.alert-warning {
    border-left-color: var(--bs-warning);
}

.alert-info {
    border-left-color: var(--bs-info);
}

/* === TABLES === */
.table {
    border-radius: 0.375rem;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table > thead {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
}

.table > thead > tr > th {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-size: 0.8em;
    color: #495057;
    padding: 0.4rem 0.5rem;
}

.table > tbody > tr > td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table > tbody > tr:last-child > td {
    border-bottom: none;
}

.table-hover > tbody > tr {
    transition: background-color 0.15s ease;
}

.table-hover > tbody > tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-striped > tbody > tr:nth-of-type(odd):hover {
    background-color: rgba(13, 110, 253, 0.06);
}

/* Table variants */
.table-dark > thead {
    background: linear-gradient(180deg, #343a40 0%, #212529 100%);
}

.table-dark > thead > tr > th {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Small tables */
.table-sm > thead > tr > th {
    padding: 0.25rem 0.4rem;
    font-size: 0.75em;
}

.table-sm > tbody > tr > td {
    padding: 0.2rem 0.4rem;
}

/* === MODALS === */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.modal-footer {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* === DROPDOWNS === */
.dropdown-menu {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--bs-primary);
}

/* === NAV TABS & PILLS === */
.nav-tabs {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.nav-tabs .nav-link {
    border-radius: 0.5rem 0.5rem 0 0;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.nav-pills .nav-link {
    border-radius: 0.5rem;
}

.nav-pills .nav-link:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.05);
}

/* === PROGRESS BARS === */
.progress {
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.06);
}

.progress-bar {
    border-radius: 0.5rem;
}

/* === TOASTS === */
.toast {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === PAGINATION === */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 0.375rem;
    border: none;
    background-color: rgba(0, 0, 0, 0.03);
}

.page-link:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.page-item.active .page-link {
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.page-item:first-child .page-link,
.page-item:last-child .page-link {
    border-radius: 0.375rem;
}

/* === BREADCRUMB === */
.breadcrumb {
    background-color: transparent;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #adb5bd;
}

/* === POPOVERS & TOOLTIPS === */
.popover {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tooltip-inner {
    border-radius: 0.375rem;
}

/* === ACCORDION === */
.accordion-item {
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.accordion-item:first-of-type {
    border-radius: 0.75rem 0.75rem 0 0;
}

.accordion-item:last-of-type {
    border-radius: 0 0 0.75rem 0.75rem;
    border-bottom: none;
}

.accordion-button {
    border-radius: 0;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(13, 110, 253, 0.05);
    box-shadow: none;
}

/* === SPINNER ENHANCEMENT === */
.spinner-border,
.spinner-grow {
    opacity: 0.8;
}

/* === UTILITY: SOFT SHADOWS === */
.shadow-soft {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shadow-soft-lg {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* === UTILITY: HOVER LIFT === */
.hover-lift {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Disable hover animation */
.no-hover-effect:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* === SIDEBAR (#sidebar) === */
#sidebar {
    z-index: 1020; /* Below fixed-top navbar (1030) */
    transition: transform 0.3s ease !important;
}

/* Override Bootstrap collapse height animation with horizontal slide */
#sidebar.collapse:not(.show) {
    display: block !important;
    transform: translateX(-100%);
}

#sidebar.collapse.show {
    transform: translateX(0);
}

#sidebar.collapsing {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    transition: transform 0.3s ease !important;
}

/* Main content slide animation */
main.main {
    transition: margin-left 0.3s ease, padding-left 0.3s ease;
}

#sidebar .list-group-item {
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    position: relative;
}

#sidebar .list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-left-color: var(--bs-primary);
    padding-left: calc(0.75rem + 3px);
}

#sidebar .list-group-item[aria-expanded="true"] {
    border-left-color: var(--bs-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

#sidebar .list-group .collapse .list-group-item:hover,
#sidebar .list-group .collapsing .list-group-item:hover {
    padding-left: calc(20px + 3px);
}

#sidebar .list-group .collapse > .collapse .list-group-item:hover,
#sidebar .list-group .collapse > .collapsing .list-group-item:hover {
    padding-left: calc(30px + 3px);
}

#sidebar .list-group-item i {
    transition: transform 0.15s ease;
}

#sidebar .list-group-item:hover i:not(.fa-angle-double-right) {
    transform: scale(1.1);
}

/* === TOP NAVBAR === */
.yggNavTop {
    z-index: 1040;
    background: linear-gradient(180deg, #2c3136 0%, #212529 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.yggNavTop .nav-link {
    transition: all 0.15s ease;
    border-radius: 0.375rem;
    margin: 0 0.125rem;
}

.yggNavTop .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.yggNavTop .navbar-nav .dropdown-menu {
    background-color: #2c3136;
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.yggNavTop .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
}

.yggNavTop .dropdown-item:hover,
.yggNavTop .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.yggNavTop .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 0.375rem 0;
}

/* Submenu styling */
.yggNavTop .dropdown-submenu .dropdown-menu {
    background-color: #343a40;
}

/* Active dropdown highlight */
.yggNavTop .nav-item.dropdown.show > .nav-link {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Brand logo subtle glow on hover */
.yggNavTop .navbar-brand:hover img {
    filter: brightness(1.1);
}

/* User dropdown enhancement */
.yggNavTop .navbar-nav .dropdown-toggle::after {
    transition: transform 0.2s ease;
}

.yggNavTop .navbar-nav .dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Mobile menu styling */
@media (max-width: 767.98px) {
    .yggNavTop .navbar-collapse {
        background-color: #2c3136;
        border-radius: 0 0 0.5rem 0.5rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }

    .yggNavTop .navbar-nav .dropdown-menu {
        background-color: rgba(0, 0, 0, 0.2);
        box-shadow: none;
        margin-top: 0;
    }
}

/* Remove underline from navbar icon links */
.yggNavTop .navbar-text,
.yggNavTop a.navbar-text {
    text-decoration: none;
}

.yggNavTop .navbar-text:hover,
.yggNavTop a.navbar-text:hover {
    text-decoration: none;
}

/* === FLOATING TOGGLE BUTTONS === */
.floating-toggle-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: all 0.3s ease;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.floating-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.floating-toggle-btn:active {
    transform: scale(0.95);
}

/* Sidebar toggle - bottom left */
#sidebar-toggle {
    z-index: 1025;
    bottom: 20px;
    left: 20px;
}

/* Chat widget toggle - bottom right */
#chat-widget-toggle {
    z-index: 1055;
    bottom: 20px;
    right: 20px;
}