/* =========================================================================
   ADERA CELL ENTERPRISE HRIS - MODERN DESKTOP UI ENHANCEMENTS (style.css)
   Tailwind CSS Extensions, Collapsible Sidebar, Slim Scrollbars & Micro-Interactions
   ========================================================================= */

/* --- 1. Custom Slim Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar scrollbar khusus */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- 2. Desktop Collapsible Sidebar (w-64 <-> w-20) --- */
@media (min-width: 1024px) {
    #sidebar {
        width: 260px;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-x: hidden;
    }

    #sidebar.collapsed {
        width: 76px;
    }

    /* Sembunyikan elemen teks saat collapsed */
    #sidebar.collapsed .sidebar-header .logo-text,
    #sidebar.collapsed .user-brief .brief-info,
    #sidebar.collapsed .sidebar-section-title span,
    #sidebar.collapsed .nav-item span,
    #sidebar.collapsed .nav-subitem span,
    #sidebar.collapsed .nav-arrow,
    #sidebar.collapsed .badge-counter,
    #sidebar.collapsed .sidebar-footer span {
        display: none !important;
        opacity: 0;
        visibility: hidden;
    }

    /* Icon dan header saat collapsed */
    #sidebar.collapsed .sidebar-header {
        padding: 20px 12px;
        justify-content: center;
    }

    #sidebar.collapsed .user-brief {
        padding: 10px 8px;
        margin: 8px 6px;
        justify-content: center;
    }

    #sidebar.collapsed .avatar-wrapper {
        margin: 0 auto;
    }

    #sidebar.collapsed .sidebar-section-title {
        padding: 12px 0 6px 0;
        text-align: center;
    }

    #sidebar.collapsed .sidebar-section-title::after {
        content: '';
        display: block;
        width: 20px;
        height: 2px;
        background: rgba(255, 255, 255, 0.15);
        margin: 4px auto 0 auto;
        border-radius: 2px;
    }

    #sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 12px 0;
        position: relative;
    }

    #sidebar.collapsed .nav-item i {
        margin: 0 !important;
        font-size: 1.15rem;
    }

    #sidebar.collapsed .nav-submenu {
        padding-left: 0;
        margin-left: 0;
        border-left: none;
    }

    #sidebar.collapsed .nav-subitem {
        justify-content: center;
        padding: 10px 0;
    }

    #sidebar.collapsed .nav-subitem i {
        margin: 0 !important;
    }

    #sidebar.collapsed .btn-sidebar-logout {
        justify-content: center;
        padding: 12px 0;
    }

    #sidebar.collapsed .btn-sidebar-logout i {
        margin: 0 !important;
    }

    /* Floating Tooltip saat Hover di Mode Collapsed */
    #sidebar.collapsed .nav-item:hover::after,
    #sidebar.collapsed .btn-sidebar-logout:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: #f8fafc;
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 700;
        white-space: nowrap;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
        z-index: 1050;
        pointer-events: none;
        border: 1px solid rgba(255, 255, 255, 0.1);
        animation: tooltipFadeIn 0.15s ease-out forwards;
    }

    @keyframes tooltipFadeIn {
        from {
            opacity: 0;
            transform: translateY(-50%) translateX(-4px);
        }

        to {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
    }
}

/* --- 3. Sidebar Section Headers & Pill Badges --- */
.sidebar-section-title {
    padding: 16px 18px 6px 18px;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Soft Pill Badges Modern */
.badge-soft-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    margin-left: auto;
    transition: all 0.2s ease;
}

.badge-soft-rose {
    background-color: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.badge-soft-amber {
    background-color: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.badge-soft-emerald {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* --- 4. Desktop Topbar Header Styling (Disembunyikan Total di Layar Desktop) --- */
@media (min-width: 1024px) {

    .ess-company-header,
    .desktop-topbar {
        display: none !important;
    }
}

/* Dropdown Profile Popup */
.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 220px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    padding: 6px;
    display: none;
    z-index: 1000;
    animation: dropDownSlide 0.15s ease-out forwards;
}

.user-dropdown-menu.show {
    display: block;
}

@keyframes dropDownSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

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

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.user-dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.user-dropdown-item.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

/* --- 5. Modern Dashboard KPI Cards --- */
.kpi-stat-card {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.kpi-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: background-color 0.2s;
}

.kpi-stat-card.card-emerald:hover::before {
    background: #2563eb;
}

.kpi-stat-card.card-teal:hover::before {
    background: #14b8a6;
}

.kpi-stat-card.card-rose:hover::before {
    background: #f43f5e;
}

.kpi-stat-card.card-amber:hover::before {
    background: #f59e0b;
}

.kpi-stat-card.card-indigo:hover::before {
    background: #6366f1;
}

/* --- 6. Quick Action Button Cards --- */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.quick-action-btn:hover {
    background: #f8fafc;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.quick-action-btn .btn-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* --- 7. Realtime Activity Feed Item --- */
.activity-feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background-color 0.15s;
    border-left: 3px solid transparent;
}

.activity-feed-item:hover {
    background-color: #f8fafc;
}

.activity-feed-item.border-attendance {
    border-left-color: #2563eb;
}

.activity-feed-item.border-reimburse {
    border-left-color: #f43f5e;
}

.activity-feed-item.border-leave {
    border-left-color: #3b82f6;
}

.activity-feed-item.border-advance {
    border-left-color: #f59e0b;
}

/* --- 8. Kasbon Mini List Item --- */
.kasbon-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

.kasbon-user-row:last-child {
    border-bottom: none;
}

.kasbon-user-row:hover {
    background-color: #f8fafc;
}

/* --- 9. Table Search Box Styling (Live Search Nama Karyawan) --- */
.search-box-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-box-wrap .search-icon {
    position: absolute;
    left: 11px;
    font-size: 0.78rem;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s ease;
}

.search-box-wrap .form-control-search {
    height: 33px;
    padding: 5px 12px 5px 30px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 175px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.search-box-wrap .form-control-search::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.search-box-wrap .form-control-search:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    width: 220px;
}

.search-box-wrap:focus-within .search-icon {
    color: #2563eb;
}

@media (max-width: 640px) {

    .search-box-wrap,
    .search-box-wrap .form-control-search {
        width: 100% !important;
    }
}

/* --- Table Action Buttons --- */
.btn-outline-danger {
    background: transparent;
    border: 1px solid #fca5a5;
    color: #dc2626;
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
    font-weight: 700;
}