/* Custom Sidebar Styles for T2I Holidays Admin */

/* Active menu item highlight */
.pe-nav-link.active {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-weight: 600;
}

/* Hover effect */
.pe-nav-link:hover {
    background-color: rgba(var(--primary-rgb), 0.05);
}

/* Active submenu item */
.pe-slide-menu .pe-nav-link.active {
    color: var(--primary);
    font-weight: 600;
    padding-left: 3rem;
    border-left: 3px solid var(--primary);
}

/* Menu icons spacing */
.pe-nav-icon {
    font-size: 1.1rem;
}

/* Submenu icons */
.pe-slide-menu .bi {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Menu titles */
.pe-menu-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 1rem 1.5rem 0.5rem;
}

/* Smooth transitions */
.pe-nav-link,
.pe-slide-menu {
    transition: all 0.3s ease;
}

/* Logo hover effect */
.pe-app-sidebar-logo a:hover {
    opacity: 0.8;
}

/* Fix for sidebar text showing behind when in icon mode */
[data-sidebar="icon"] .pe-app-sidebar {
    overflow: hidden !important;
}

[data-sidebar="icon"] .pe-nav-content,
[data-sidebar="icon"] .pe-nav-arrow,
[data-sidebar="icon"] .pe-menu-title {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

[data-sidebar="icon"] .pe-slide-menu {
    display: none !important;
}

[data-sidebar="icon"] .pe-nav-link {
    justify-content: center;
    padding: 0.75rem;
}

[data-sidebar="icon"] .pe-nav-icon {
    margin: 0 !important;
}

/* Ensure proper z-index and fixed positioning */
.pe-app-sidebar {
    z-index: 1005;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    overflow-x: hidden;
}

/* Smooth transition when toggling */
.pe-app-sidebar {
    transition: width 0.3s ease, left 0.3s ease;
}

.pe-nav-content,
.pe-nav-arrow {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hide scrollbar in icon mode */
[data-sidebar="icon"] .pe-app-sidebar-menu {
    overflow: hidden !important;
}

/* Tooltip support for icon mode */
[data-sidebar="icon"] .pe-nav-link {
    position: relative;
    cursor: pointer;
}

[data-sidebar="icon"] .pe-nav-link::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bs-dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-left: 1rem;
    z-index: 1001;
    font-size: 0.875rem;
}

[data-sidebar="icon"] .pe-nav-link:hover::after {
    opacity: 0.9;
}

/* Hover effect for icon mode menu items */
[data-sidebar="icon"] .pe-has-sub>.pe-nav-link:hover {
    background-color: rgba(var(--primary-rgb), 0.15);
}

/* Popover styling */
.sidebar-icon-popover {
    animation: fadeInPopover 0.2s ease-in-out;
}

@keyframes fadeInPopover {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fix dashboard logo visibility when sidebar is in icon mode */
[data-sidebar=icon] .pe-app-sidebar .pe-app-sidebar-logo {
    position: relative !important;
    top: 0 !important;
    background-color: var(--pe-app-sidebar-bg) !important;
    width: 4.4rem !important;
    border-right: 1px solid var(--pe-border-color) !important;
    z-index: auto !important;
}

.card-title {
    font-size: 20px;
    margin-bottom: 0;
    color: var(--pe-body-color);
}

.bg-info-1 {
    background-color: #FE0000 !important;
    color: #fff !important;
}

@media (min-width: 992px) {
    [data-sidebar=icon] .app-header {
        left: 4.4rem;
    }

    [data-sidebar="icon"] .app-wrapper {
        transition: margin-left 0.3s ease;
    }

    [data-sidebar="icon"] .table-responsive {
        transition: width 0.3s ease;
    }

    [data-sidebar="icon"] .pe-app-sidebar {
        width: 70px !important;
    }
}

.text-dark-custom {
    color: #212529 !important;
}

.btn-dark-custom {
    background-color: #212529 !important;
    color: white
}

.btn-dark-custom:hover {
    background-color: #212529 !important;
    color: white
}

/* Table Alignment Fix for Sidebar Toggle */

/* Fix table width during sidebar toggle */
.table {
    table-layout: auto;
    transition: none;
}

/* DataTables specific fixes */
.dataTables_scrollBody {
    transition: width 0.3s ease;
}

/* Ensure card maintains proper width */
.card {
    transition: width 0.3s ease;
}

/* Fix for content width during sidebar toggle */
@media (min-width: 992px) {
    .app-wrapper .container-fluid {
        max-width: 100%;
        transition: max-width 0.3s ease;
    }
}

/* Fix table overflow */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}

/* Ensure smooth transition without layout shift */
* {
    box-sizing: border-box;
}

/* Fix for buttons and action columns */
.table .btn-group,
.table .dropdown {
    white-space: nowrap;
}

/* Prevent content jump */
.row {
    transition: margin-left 0.3s ease, margin-right 0.3s ease;
}

/* Stabilize table header */
.table thead th {
    position: relative;
}

/* Ensure pagination doesn't shift */
.dataTables_paginate {
    transition: none;
    margin-top: 1rem;
}

/* Fix for row hover during transitions */
.table-hover tbody tr {
    transition: background-color 0.15s ease-in-out;
}

/* Additional stability fixes */
.card {
    will-change: auto;
}

/* Prevent flash of content during transition */
.app-wrapper>.container-fluid {
    position: relative;
}

/* Dashboard specific table fixes */
#layout-wrapper .table {
    width: 100% !important;
    table-layout: fixed;
}

#layout-wrapper .table th,
#layout-wrapper .table {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure dashboard card body containing tables */
#layout-wrapper .card-body .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Prevent dashboard tables from shifting */
#layout-wrapper .card {
    transition: width 0.3s ease;
}

/* Ensure text doesn't wrap in specific columns */
.text-nowrap {
    white-space: nowrap !important;
}

/* Ensure dashboard table cells have consistent height */
#layout-wrapper .table td {
    vertical-align: middle;
    padding: 0.75rem;
}

#layout-wrapper .table thead th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem;
}

/* Fix for table hover effect */
#layout-wrapper .table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

[data-bs-theme="dark"] #layout-wrapper .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.025);
}

/* Sidebar Footer Styling */
.pe-sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--pe-app-sidebar-bg);
    border-top: 1px solid var(--pe-border-color);
    padding: 0.75rem 0;
    z-index: 10;
}

.pe-sidebar-footer .pe-nav-link {
    color: var(--pe-danger, #dc3545);
    padding: 12px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pe-sidebar-footer .pe-nav-link:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.pe-sidebar-footer .pe-nav-icon {
    font-size: 1.0625rem;
    width: 20px;
}

.pe-sidebar-footer .pe-nav-content {
    font-size: 0.875rem;
}

/* Icon mode footer styling */
[data-sidebar="icon"] .pe-sidebar-footer .pe-nav-link {
    justify-content: center;
    padding: 0.75rem;
}

[data-sidebar="icon"] .pe-sidebar-footer .pe-nav-content {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

[data-sidebar="icon"] .pe-sidebar-footer .pe-nav-icon {
    margin: 0 auto;
}

/* Adjust sidebar menu height to account for footer */
.pe-app-sidebar-menu {
    height: calc(100% - var(--pe-app-header-height) - 60px) !important;
}

/* Footer width in icon mode */
[data-sidebar="icon"] .pe-sidebar-footer {
    width: 70px;
}

/* Responsive Sidebar for Mobile/Tablet */
@media (max-width: 991.98px) {
    .pe-app-sidebar {
        left: -260px !important;
        width: 260px !important;
        z-index: 1050 !important;
        /* Above everything */
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        transition: left 0.3s ease;
    }

    .pe-app-sidebar.show {
        left: 0 !important;
    }

    .app-header {
        z-index: 1060;
        /* Above sidebar and backdrop */
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .pe-app-sidebar.show~.sidebar-backdrop {
        display: block !important;
        opacity: 1 !important;
    }

    .vertical-toggle {
        display: inline-flex !important;
    }
}

.sidebar-backdrop {
    display: none;
}

/* Profile Dropdown Enhancements */
.header-profile-btn {
    transition: all 0.3s ease;
    border-radius: 12px !important;
}

.header-profile-btn:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.profile-dropdown-menu {
    border: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border-radius: 16px !important;
    padding: 0 !important;
    min-width: 260px !important;
    background: #ffffff !important;
    overflow: hidden;
    margin-top: 10px !important;
}

.profile-info-section {
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
    padding: 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.profile-avatar-initial {
    border: 2px solid white;
    transition: transform 0.3s ease;
}

.header-profile-btn:hover .profile-avatar-initial {
    transform: scale(1.05);
}

.profile-dropdown-item {
    border-radius: 10px !important;
    margin: 4px 8px;
    padding: 10px 15px !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bs-body-color);
    text-decoration: none;
}

.profile-dropdown-item:hover {
    background-color: #fff5f5 !important;
    color: #FE0000 !important;
    transform: translateX(5px);
}

.profile-dropdown-item i {
    font-size: 1.2rem;
}