:root {
    --sidebar-bg: #0f1d40;
    --sidebar-text: #cfd6ff;
    --sidebar-active: #2f5bff;

    --header-bg: #ffffff;
    --border-color: #f1f5f9;

    --body-bg: #f8fafc;
    --text-dark: #0f172a;
    --muted: #64748b;

    --radius-sm: 6px;
    --radius-md: 10px;
}

body {
    margin: 0;
    background: var(--body-bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

.app-shell {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell.no-sidebar {
    margin-left: 0 !important;
}


.app-content {
    padding: 20px 24px;
    flex: 1;
}

/* ===== HEADER ===== */

.ww-header {
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;
}

.ww-header-left {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.ww-menu-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 6px;
    margin-right: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ww-menu-btn:hover {
    background-color: var(--border-color);
    color: var(--sidebar-active);
}

.ww-header-search {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 10px;
}

.ww-header-search input {
    width: 100%;
    max-width: 320px;
    height: 36px;
    background-color: #f1f5f9;
    border-radius: 20px;
    border: 1px solid transparent;
    padding: 0 14px;
    font-size: 13px;
    transition: all 0.2s;
}

.ww-header-search input:focus {
    background-color: #fff;
    border-color: var(--sidebar-active);
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.1);
}

.ww-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ww-sidebar-group-body .ww-icon {
    font-size: 16px;
    cursor: pointer;
    filter: invert(70%) sepia(11%) saturate(350%) hue-rotate(182deg) brightness(93%) contrast(89%);
}

.ww-sidebar-brand .ww-icon {
    filter: invert(70%) sepia(11%) saturate(350%) hue-rotate(182deg) brightness(93%) contrast(89%);
}

/* Ensure sidebar scroll works */
#ww-sidebar {
  overflow-y: auto;

  /* Firefox support */
  scrollbar-width: thin;
  scrollbar-color: #2a3f7a #0f1d40;
}

/* WebKit browsers (Chrome, Edge, Safari) */
#ww-sidebar::-webkit-scrollbar {
  width: 10px;
}

#ww-sidebar::-webkit-scrollbar-track {
  background: #0f1d40; /* sidebar background */
}

#ww-sidebar::-webkit-scrollbar-thumb {
  background-color: #2a3f7a; /* slightly lighter for contrast */
  border-radius: 6px;
  border: 2px solid #0f1d40; /* creates spacing effect */
}

#ww-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: #3b55a0; /* hover state */
}

.ww-icon {
    font-size: 16px;
    cursor: pointer;
    /*filter: invert(70%) sepia(11%) saturate(350%) hue-rotate(182deg) brightness(93%) contrast(89%);*/
}

.ww-user {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: pointer;
}

.ww-avatar {
    width: 30px;
    height: 30px;
    background: var(--sidebar-active);
    color: #fff;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
}

.ww-username {
    font-size: 13px;
}

.ww-user-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 140px;
    display: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.ww-user-menu {
    display: none;
}

.ww-user-menu.open {
    display: block;
    z-index:1000;
}

.ww-user-menu a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    font-size: 13px;
    color: #1f2937;
}

.ww-user-menu a:hover {
    background: #f3f4f6;
}

/* ========== Footer ========== */

.app-footer {
    padding: 10px 20px;
    font-size: 12px;
    color: var(--muted);
    background: transparent;
}

/* ========== SIDEBAR ========== */

.ww-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: #cfd6ff;

    display: flex;
    flex-direction: column;

    transition: width 0.2s ease;
    z-index: 1000;
}

.ww-sidebar.collapsed {
    width: 72px;
}

/* Brand */

.ww-sidebar-brand {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;

    font-size: 18px;
    font-weight: 600;
    color: #ffffff;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: hidden;
}

/* Nav */

.ww-sidebar-nav {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.ww-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px 12px;
    margin-bottom: 4px;

    color: #cfd6ff;
    text-decoration: none;
    font-size: 14px;

    border-radius: 8px;
    white-space: nowrap;

    transition: background 0.15s ease;
}

.ww-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Active Item */

.ww-nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
}

/* Icon */

.ww-icon {
    text-align: center;
    font-size: 16px;
}

/* Text */

.ww-text {
    transition: opacity 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: -20px;
}

/* Collapsed Behavior */

.ww-sidebar.collapsed .ww-text {
    display: none;
}
/*
.ww-group-label{
    padding-left: 10px;
}
*/

.ww-sidebar.collapsed .ww-group-label,
.ww-sidebar.collapsed .ww-group-arrow {
    display: none;
}

.ww-sidebar.collapsed .ww-sidebar-brand {
    justify-content: center;
    padding: 0;
}

.ww-sidebar.collapsed .ww-nav-item,
.ww-sidebar.collapsed .ww-sidebar-group-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.ww-sidebar.collapsed .ww-icon,
.ww-sidebar.collapsed .ww-icon img {
    margin-right: 0;
}

.ww-sidebar.collapsed .ww-sidebar-nav {
    overflow: visible;
}

/* ========== CONTENT SHIFT ========== */

.app-shell {
    margin-left: 240px;
    transition: margin-left 0.2s ease;
}

.app-shell.sidebar-collapsed {
    margin-left: 72px;
}

/* ========== SIDEBAR OVERLAY ========== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 990;
    /* Just below the sidebar */
    transition: opacity 0.2s ease;
}

.sidebar-overlay.show {
    display: block;
}

/* ========== MOBILE ========== */

@media (max-width: 768px) {

    .ww-sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .ww-sidebar.open {
        transform: translateX(0);
    }

    .app-shell {
        margin-left: 0 !important;
    }

    .app-content {
        padding: 16px 12px;
    }
}

@media (max-width: 576px) {
    .ww-username {
        display: none;
        /* Hide username on very small screens to save space */
    }

    .ww-header {
        padding: 0 12px;
    }
}

/* TOOLTIP */

.ww-nav-item {
    position: relative;
}

.ww-sidebar.collapsed .ww-nav-item:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);

    background: #1f2937;
    color: #fff;

    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 2000;
}

.ww-sidebar-group-header {
    position: relative;
}

.ww-sidebar.collapsed .ww-sidebar-group-header:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    z-index: 2000;
}

/* Super Admin Css */

.card h3 {
    font-weight: 600;
}

.card small {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table td {
    vertical-align: middle;
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border: 1px solid transparent;
    cursor: move;
}

.sortable-item.dragging {
    opacity: 0.5;
}

.drag-handle {
    cursor: grab;
    color: #999;
}

.ww-icon img {
    display: flex;
    align-items: center;
    margin-right: 12px;
    width: 28px;
}

.ww-nav-item:hover .ww-icon img,
.ww-nav-item.active .ww-icon img {
    opacity: 1;
}

/* DASHBOARD + TOP ITEMS */

.ww-top-item {
    font-weight: 500;
    margin-bottom: 10px;
}

/* GROUP CONTAINER */

.ww-sidebar-group {
    margin-top: 18px;
}

/* GROUP HEADER */

.ww-sidebar-group-header {
    display: flex;
    justify-content: start;
    gap: 2px;
    align-items: center;
    padding: 6px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    transition: 0.2s ease;
}

.ww-sidebar-group-header:hover {
    color: rgba(255, 255, 255, 0.9);
}

.ww-group-arrow {
    display: flex;
    align-items: center;
    margin-left: auto;
    /* MAGIC TRICK: This pushes the arrow to the far right */
}

/* GROUP BODY */

.ww-sidebar-group-body {
    margin-top: 4px;
    padding-left: 6px;
}

/* MODULE ITEMS */

.ww-sub-item {
    padding: 10px 14px;
    margin: 4px 10px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    transition: 0.2s ease;
}

.ww-sidebar.collapsed .ww-sub-item {
    margin: 4px 8px;
    padding: 10px;
}

/* ACTIVE */

.ww-nav-item.active {
    background: linear-gradient(135deg, #4e73ff, #375bdb);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* HOVER */

.ww-nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06);
}

/* COLLAPSE */

.ww-collapsed {
    display: none;
}

@media print {

    body {
        margin: 20mm;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
    }

}

.ww-search-box input {
    width: 420px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.ww-search-results {
    position: absolute;
    top: 50px;
    width: 420px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow: auto;
    z-index: 9999;
}

.ww-search-group {
    padding: 8px 0;
}

.ww-search-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    padding: 6px 12px;
}

.ww-search-item {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
    color: #333;
    font-size: 0.875rem;
}

.ww-search-item:hover {
    background: #f5f5f5;
}

.ww-search-empty {
    padding: 12px;
    color: #888;
}

/* =========================================================
   PRIMARY BRANDING OVERRIDES (Matches Sidebar)
========================================================= */
.btn-primary {
    --bs-btn-bg: var(--sidebar-bg);
    --bs-btn-border-color: var(--sidebar-bg);
    --bs-btn-hover-bg: #162a5c;
    --bs-btn-hover-border-color: #162a5c;
    --bs-btn-active-bg: #162a5c;
    --bs-btn-active-border-color: #162a5c;
    --bs-btn-disabled-bg: var(--sidebar-bg);
    --bs-btn-disabled-border-color: var(--sidebar-bg);
}

.btn-outline-primary {
    --bs-btn-color: var(--sidebar-bg);
    --bs-btn-border-color: var(--sidebar-bg);
    --bs-btn-hover-bg: var(--sidebar-bg);
    --bs-btn-hover-border-color: var(--sidebar-bg);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--sidebar-bg);
    --bs-btn-active-border-color: var(--sidebar-bg);
    --bs-btn-active-color: #fff;
}

.text-primary {
    color: var(--sidebar-bg) !important;
}
/* ========== NOTIFICATIONS ========== */

.ww-notifications {
    position: relative;
    margin-right: 8px;
}

.ww-notification-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.ww-notification-btn:hover {
    background: #f1f5f9;
    color: var(--sidebar-active);
}

.ww-notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

.ww-notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 320px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.ww-notification-dropdown.show {
    display: block;
}

.ww-notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.ww-notif-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.ww-notif-body {
    max-height: 360px;
    overflow-y: auto;
}

.ww-notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: background 0.2s;
}

.ww-notif-item:hover {
    background: #f8fafc;
}

.ww-notif-item.unread {
    background: #f0f7ff;
}

.ww-notif-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-dark);
}

.ww-notif-message {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.ww-notif-time {
    font-size: 11px;
    color: #94a3b8;
}

.ww-notif-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.ww-notif-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

.ww-notif-footer a {
    font-size: 12px;
    font-weight: 600;
    color: var(--sidebar-active);
    text-decoration: none;
}
