/* ═══════════════════════════════════════════════════════
   CIRCLES ADMIN SHARED DESIGN SYSTEM
   Common Styles for all Admin & Management Pages
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --ink-0: #F3F4F6;
    --ink-1: #D1D5DB;
    --ink-2: #9CA3AF;
    --ink-3: #6B7280;
    --ink-4: #374151;
    --base: #020617;
    --base-2: #0F172A;
    --surface: rgba(15, 23, 42, 0.75);
    --surface-2: #1E293B;
    --edge: rgba(255, 255, 255, 0.05);
    --edge-2: rgba(255, 255, 255, 0.08);
    --violet: #6366F1;
    --violet-d: #4F46E5;
    --violet-l: rgba(99, 102, 241, 0.12);
    --azure: #38BDF8;
    --azure-l: rgba(56, 189, 248, 0.12);
    --emerald: #10B981;
    --rose: #F472B6;
    --grad: linear-gradient(135deg, #6366F1 0%, #3B82F6 100%);
    --font-u: 'Inter', system-ui, sans-serif;
    --font-d: 'Instrument Serif', Georgia, serif;
    --sidebar-w: 260px;
    --topbar-h: 72px;
    --radius: 12px;
    --radius-lg: 16px;
    --pill: 9999px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --danger: #EF4444;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-u);
    background: var(--base);
    color: var(--ink-0);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* ── Light Mode Palette ── */
body.light-mode {
    --ink-0: #0F172A;
    --ink-1: #334155;
    --ink-2: #64748B;
    --ink-3: #94A3B8;
    --ink-4: #E2E8F0;
    --base: #F8FAFC;
    --base-2: #F1F5F9;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-2: #FFFFFF;
    --edge: rgba(0, 0, 0, 0.08);
    --edge-2: rgba(0, 0, 0, 0.12);
    --violet-l: rgba(99, 102, 241, 0.08);
}

body.light-mode::after {
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
}

body.light-mode .global-popover {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

body.light-mode .popover-header {
    background: rgba(255, 255, 255, 0.9);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--surface);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-right: 1px solid var(--edge);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--edge);
    gap: 10px;
    flex-shrink: 0;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink-0);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.logo-svg {
    width: 26px;
    height: 26px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-lbl {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-2);
    padding: 14px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink-1);
    cursor: pointer;
    transition: all .12s;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--base-2);
    color: var(--ink-0);
}

.nav-item.active {
    background: var(--grad);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(100, 80, 255, 0.3);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-badge {
    margin-left: auto;
    background: var(--violet);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--edge);
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.av-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 12px;
    background: var(--grad);
    flex-shrink: 0;
}

.u-name {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.u-role {
    font-size: 12px;
    color: var(--ink-2);
    font-weight: 500;
}

/* ── Main / Topbar ── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border-bottom: 1px solid var(--edge);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-ev {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.ev-sel {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--edge-2);
    background: var(--surface);
    font-weight: 600;
}

.ev-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink-2);
    font-weight: 500;
}

.tb-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-1);
    transition: all 0.1s;
    border: none;
    background: transparent;
    position: relative;
}

.icon-btn:hover {
    background: var(--base-2);
}

.notif-dot {
    width: 7px;
    height: 7px;
    background: var(--violet);
    border-radius: 50%;
    position: absolute;
    top: 8px;
    right: 9px;
    border: 2px solid #fff;
}

/* ── Content ── */
.content {
    flex: 1;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.page-hdr {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-title {
    font-family: var(--font-d);
    font-size: 3.2rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink-0);
}

.page-sub {
    font-size: 14px;
    color: var(--ink-2);
    margin-top: 8px;
    font-weight: 500;
}

.hdr-actions {
    display: flex;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--pill);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-sec {
    background: var(--surface-2);
    color: var(--ink-0);
    border: 1px solid var(--edge-2);
}

.btn-sec:hover {
    border-color: var(--violet);
}

.btn-pri {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 2px 12px rgba(96, 64, 240, 0.28);
}

.btn-pri:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(96, 64, 240, 0.35);
}

/* Utility for hidden elements */
[style*="display:none"],
[style*="display: none"] {
    display: none !important;
}

/* ── Animations ── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

@keyframes pulseLive {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes grow {
    from {
        width: 0;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes subtleShake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(1deg);
    }

    75% {
        transform: rotate(-1deg);
    }
}

.animate-fade {
    animation: fadeIn 0.6s var(--ease) forwards;
}

.animate-fade-up {
    opacity: 0;
    animation: fadeUp 0.6s var(--ease) forwards;
}

.animate-fade-down {
    opacity: 0;
    animation: fadeDown 0.6s var(--ease) forwards;
}

.animate-zoom {
    opacity: 0;
    animation: zoomIn 0.5s var(--ease) forwards;
}

.animate-slide {
    animation: slideInLeft 0.5s var(--ease) forwards;
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

.animate-shake:hover {
    animation: subtleShake 0.3s var(--ease) infinite;
}

.live-dot {
    animation: pulseLive 2s infinite;
}

/* Staggered entry for grids */
.stagger-entry>* {
    opacity: 0;
    animation: fadeIn 0.5s var(--ease) forwards;
}

.stagger-entry>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-entry>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-entry>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-entry>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-entry>*:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger-entry>*:nth-child(6) {
    animation-delay: 0.6s;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .nav-lbl,
    .u-name,
    .u-role,
    .nav-item span:not(.nav-badge),
    .nav-logo span {
        display: none;
    }

    .main {
        margin-left: 80px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar-logo {
        justify-content: center;
        padding: 0;
    }
}

/* ── Global Toast Notification ── */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(150px);
    background: var(--ink-0);
    color: var(--base);
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    transition: transform .35s cubic-bezier(.18, .89, .32, 1.28), opacity .35s;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    font-family: var(--font-u);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.toast.success svg {
    color: var(--emerald);
}

.toast.error svg {
    color: var(--danger);
}

.toast.info svg {
    color: var(--azure);
}

/* ── Global Popovers (Event Selector & Notifications) ── */
.global-popover {
    position: absolute;
    top: 60px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--edge-2);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    width: 320px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.global-popover.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.popover-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--edge-2);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(13, 12, 26, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2;
}

.popover-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--edge);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.popover-item:hover {
    background: var(--surface-2);
}

.popover-item:last-child {
    border-bottom: none;
}

.popover-item.active {
    background: rgba(96, 64, 240, 0.08);
}

.popover-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--violet);
    flex-shrink: 0;
}

.popover-item-content {
    flex: 1;
    min-width: 0;
}

.popover-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.popover-item-sub {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar for popovers */
.global-popover::-webkit-scrollbar {
    width: 6px;
}

.global-popover::-webkit-scrollbar-thumb {
    background: var(--edge-2);
    border-radius: 4px;
}