@import url('/css/design-tokens.css?v=20260609');  /* design system: single source of truth — see /DESIGN.md */

/*
 * Modern Sidebar Navigation - CSS Only
 * No DOM manipulation, pure CSS positioning
 */

/* Sidebar Container */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.dark .app-sidebar {
    background: #0a0a0a;
    border-right-color: #1a1a1a;
}

/* Collapsed State - Icon Only */
.app-sidebar.collapsed {
    width: 64px;
}

/* Hide text elements when collapsed */
.app-sidebar.collapsed .sidebar-logo-text,
.app-sidebar.collapsed .sidebar-user-details,
.app-sidebar.collapsed .sidebar-token-usage,
.app-sidebar.collapsed .sidebar-nav-title,
.app-sidebar.collapsed .sidebar-nav-item span,
.app-sidebar.collapsed .sidebar-nav-chevron,
.app-sidebar.collapsed .sidebar-submenu {
    display: none;
}

/* Hide logo parts when collapsed - show only "1C" */
.app-sidebar.collapsed .logo-transform-container,
.app-sidebar.collapsed .char-l,
.app-sidebar.collapsed .char-i,
.app-sidebar.collapsed .char-c,
.app-sidebar.collapsed .char-k {
    display: none;
}

/* Disable C animation when collapsed */
.app-sidebar.collapsed .char-C {
    animation: none;
}

/* Center animated logo when collapsed */
.app-sidebar.collapsed .logo-animated {
    justify-content: center;
}

/* Center icons when collapsed */
.app-sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
    cursor: pointer;
}

.app-sidebar.collapsed .sidebar-header:hover {
    background: #f3f4f6;
}

.dark .app-sidebar.collapsed .sidebar-header:hover {
    background: #1f2937;
}

.app-sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-user {
    padding: 1rem 0.5rem;
}

.app-sidebar.collapsed .sidebar-user-info {
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 0.625rem 0.5rem;
    margin: 0.25rem 0.5rem;
}

/* Hide toggle button when collapsed */
.app-sidebar.collapsed #sidebarToggle {
    display: none;
}

/* Rotate toggle icon when collapsed (if shown) */
.app-sidebar.collapsed #sidebarToggle svg {
    transform: rotate(180deg);
}

/* Main Content Adjustment */
body.has-sidebar {
    margin-left: 240px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-sidebar.sidebar-collapsed {
    margin-left: 64px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dark .sidebar-header {
    border-bottom-color: #1a1a1a;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo img {
    height: 32px;
    width: 32px;
    object-fit: contain;
}

.sidebar-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

.dark .sidebar-logo-text {
    color: #f9fafb;
}

/* Animated Logo */
.logo-animated {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 1.125rem;
    line-height: 1.4;
}

/* Glow background - hidden */
.logo-glow {
    display: none;
}

/* The "1Click" that clicks */
.logo-click-part {
    display: inline-block;
    font-weight: 700;
    position: relative;
}

/* Individual character styling - each gets gradient */
.logo-click-part span {
    display: inline-block;
    background: linear-gradient(135deg, #9333ea, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* C character - goes up and tilts for the "click" effect */
.char-C {
    animation: charC_click 8s ease-in-out infinite;
    transform-origin: bottom center;
}

/* Ripple effect - each letter bounces after C bends */
.char-l {
    animation: charRipple1 8s ease-in-out infinite;
    transform-origin: bottom center;
}

.char-i {
    animation: charRipple2 8s ease-in-out infinite;
    transform-origin: bottom center;
}

.char-c {
    animation: charRipple3 8s ease-in-out infinite;
    transform-origin: bottom center;
}

.char-k {
    animation: charRipple4 8s ease-in-out infinite;
    transform-origin: bottom center;
}

/* "lick" stays static - REMOVED, merged into click-part */
.logo-static {
    display: none;
}

.dark .logo-static {
    display: none;
}

/* Container for transform effect - FIXED BASELINE */
.logo-transform-container {
    position: relative;
    display: inline-block;
    width: 60px;
    vertical-align: baseline;
}

/* "Report" text - FIXED: Now inline-block for proper baseline alignment */
.logo-report-text {
    display: inline-block;
    line-height: 1;
    font-weight: 400;
    color: #111827;
    white-space: nowrap;
    opacity: 1;
    animation: textToGraph 8s ease-in-out infinite;
}

.dark .logo-report-text {
    color: #f9fafb;
}

/* For light backgrounds, use dark text */
.logo-report-text.dark-text {
    color: #111827;
}

/* Graph container - FIXED: top positioning */
.logo-graph {
    position: absolute;
    left: 0;
    top: 2px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    opacity: 0;
    animation: graphAppear 8s ease-in-out infinite;
}

/* Individual bars */
.bar {
    width: 8px;
    background: linear-gradient(180deg, #9333ea, #4f46e5);
    border-radius: 2px 2px 0 0;
    transform-origin: bottom;
}

.bar-1 {
    height: 100%;
    animation: barGrow1 8s ease-in-out infinite;
}

.bar-2 {
    height: 70%;
    animation: barGrow2 8s ease-in-out infinite;
}

.bar-3 {
    height: 85%;
    animation: barGrow3 8s ease-in-out infinite;
}

.bar-4 {
    height: 60%;
    animation: barGrow4 8s ease-in-out infinite;
}

/* ── Animated cycling wordmark: Report → Ads → Agents → rest on Report ──
   Default state (no JS) shows "Report" + bars; sidebar.js drives the once-on-load reveal. */
.logo-cycle { position: relative; display: inline-flex; align-items: baseline; }
.logo-cycle .lc-word { font-weight: 700; color: var(--text, #111827); transition: opacity .35s, transform .35s, filter .35s; }
.logo-cycle .lc-word.out { opacity: 0; transform: translateY(-4px) scale(.96); filter: blur(2px); }
.logo-cycle .lc-bars { display: inline-flex; align-items: flex-end; gap: 2px; margin-left: 4px; height: .7em; width: 18px; opacity: 1; overflow: hidden; transition: width .35s, opacity .35s; }
.logo-cycle .lc-bars.lc-hide { width: 0; opacity: 0; }
.logo-cycle .lc-bars i { width: 3px; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, #6ee7b7, #34d399); transform: scaleY(1); transform-origin: bottom; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.logo-cycle .lc-bars.lc-hide i { transform: scaleY(0); }
.logo-cycle .lc-bars i:nth-child(1){ height:42%; }
.logo-cycle .lc-bars i:nth-child(2){ height:72%; }
.logo-cycle .lc-bars i:nth-child(3){ height:100%; }
.logo-cycle .lc-bars i:nth-child(4){ height:60%; }
.logo-cycle .lc-sparks { position: absolute; inset: 0; pointer-events: none; }
.logo-cycle .lc-sparks .s { position: absolute; color: #8b5cf6; opacity: 0; font-size: .62em; filter: drop-shadow(0 0 3px rgba(139,92,246,.6)); }
.logo-cycle .lc-sparks .s.fire { animation: lcspark .7s ease-out forwards; }
@keyframes lcspark { 0%{opacity:0;transform:scale(.2)} 25%{opacity:1;transform:scale(1.1) rotate(20deg)} 100%{opacity:0;transform:scale(.3) translateY(-8px) rotate(50deg)} }
.app-sidebar.collapsed .logo-cycle { display: none; }

/* ANIMATIONS */

/* C character clicks - goes up straight, then tilts */
@keyframes charC_click {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    /* Move up straight */
    5% {
        transform: translateY(-50%) rotate(0deg);
    }
    /* Then tilt 30deg to the right */
    10% {
        transform: translateY(-50%) rotate(30deg);
    }
    /* Return to normal */
    15% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

/* Ripple animations - each letter bounces in sequence */
@keyframes charRipple1 {
    0%, 10% {
        transform: translateY(0);
    }
    12% {
        transform: translateY(-8px);
    }
    14% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes charRipple2 {
    0%, 12% {
        transform: translateY(0);
    }
    14% {
        transform: translateY(-8px);
    }
    16% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes charRipple3 {
    0%, 14% {
        transform: translateY(0);
    }
    16% {
        transform: translateY(-8px);
    }
    18% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

@keyframes charRipple4 {
    0%, 16% {
        transform: translateY(0);
    }
    18% {
        transform: translateY(-8px);
    }
    20% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(0);
    }
}

/* Text fades out when graph appears - starts after ripple finishes */
@keyframes textToGraph {
    0%, 20% {
        opacity: 1;
        transform: scale(1);
    }
    22%, 50% {
        opacity: 0;
        transform: scale(0.8);
    }
    55%, 100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Graph appears when text disappears - starts after ripple finishes */
@keyframes graphAppear {
    0%, 20% {
        opacity: 0;
        transform: translateY(10px);
    }
    22%, 50% {
        opacity: 1;
        transform: translateY(0);
    }
    55%, 100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Bars grow slowly with staggered timing - starts after ripple finishes */
@keyframes barGrow1 {
    0%, 22% {
        transform: scaleY(0);
    }
    35% {
        transform: scaleY(1);
    }
    50%, 100% {
        transform: scaleY(0);
    }
}

@keyframes barGrow2 {
    0%, 24% {
        transform: scaleY(0);
    }
    37% {
        transform: scaleY(1);
    }
    50%, 100% {
        transform: scaleY(0);
    }
}

@keyframes barGrow3 {
    0%, 26% {
        transform: scaleY(0);
    }
    39% {
        transform: scaleY(1);
    }
    50%, 100% {
        transform: scaleY(0);
    }
}

@keyframes barGrow4 {
    0%, 28% {
        transform: scaleY(0);
    }
    41% {
        transform: scaleY(1);
    }
    50%, 100% {
        transform: scaleY(0);
    }
}

/* Removed: Glow pulse animation (no longer used) */

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dark .sidebar-toggle-btn {
    border-color: #374151;
    color: #9ca3af;
}

.sidebar-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.dark .sidebar-toggle-btn:hover {
    background: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

/* User Section */
.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.dark .sidebar-user {
    border-bottom-color: #1a1a1a;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .sidebar-user-name {
    color: #f9fafb;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .sidebar-user-email {
    color: #9ca3af;
}

/* AI Token Usage */
.sidebar-token-usage {
    padding: 0.75rem 1rem;
    background: transparent;
}

.dark .sidebar-token-usage {
    background: transparent;
}

.sidebar-token-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.sidebar-token-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
}

.sidebar-token-percentage {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6366f1;
}

.sidebar-token-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.dark .sidebar-token-bar {
    background: #1f2937;
}

.sidebar-token-bar-fill {
    height: 100%;
    background: #6366f1;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.sidebar-token-remaining {
    font-size: 0.625rem;
    color: #6b7280;
    text-align: right;
}

.dark .sidebar-token-remaining {
    color: #9ca3af;
}

/* Navigation */
.sidebar-nav {
    padding: 0.5rem 0;
}

.sidebar-nav-section {
    padding: 0.5rem 0;
}

/* Parent item with submenu */
.sidebar-nav-parent {
    cursor: pointer;
    position: relative;
}

.sidebar-nav-chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-nav-parent.expanded .sidebar-nav-chevron {
    transform: rotate(180deg);
}

/* Submenu container */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.expanded {
    max-height: 500px;
}

/* Submenu items */
.sidebar-submenu-item {
    padding-left: 3rem !important;
    font-size: 0.8125rem;
}

.sidebar-submenu-item svg {
    width: 18px;
    height: 18px;
}

.sidebar-nav-title {
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

.dark .sidebar-nav-title {
    color: #6b7280;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    margin: 0 0.5rem;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.dark .sidebar-nav-item {
    color: #9ca3af;
}

.sidebar-nav-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.dark .sidebar-nav-item:hover {
    background: #1f2937;
    color: #f9fafb;
}

.sidebar-nav-item.active {
    background: #eef2ff;
    color: #6366f1;
}

.dark .sidebar-nav-item.active {
    background: #1e1b4b;
    color: #a5b4fc;
}

.sidebar-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

.dark .sidebar-footer {
    border-top-color: #1a1a1a;
}

/* Tooltips for collapsed state */
.app-sidebar.collapsed .sidebar-nav-item {
    position: relative;
}

.app-sidebar.collapsed .sidebar-nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: #ffffff;
    font-size: 0.875rem;
    white-space: nowrap;
    border-radius: 6px;
    z-index: 1001;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark .app-sidebar.collapsed .sidebar-nav-item:hover::after {
    background: #374151;
}

/* Mobile: Hide sidebar by default */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-240px);
    }

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

    body.has-sidebar {
        margin-left: 0;
    }

    /* On mobile, don't show icon-only state */
    .app-sidebar.collapsed {
        transform: translateX(-240px);
        width: 240px;
    }

    body.has-sidebar.sidebar-collapsed {
        margin-left: 0;
    }
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Smooth scrollbar */
.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .app-sidebar::-webkit-scrollbar-thumb {
    background: #374151;
}

/* ============================================================
   OFF-WHITE LIGHT THEME — global
   Tints the bright-white light theme to a soft off-white on every
   page that loads this stylesheet. Dark mode is untouched.
   ============================================================ */
/* Render native controls (select dropdowns, scrollbars, date pickers) in the
   app's theme — not the OS appearance. Fixes dark <select> on dark-mode OS. */
html:not(.dark) { color-scheme: light; }
html.dark { color-scheme: dark; }
/* Belt-and-suspenders: force light <select> rendering in light mode regardless of OS appearance */
html:not(.dark) select {
  color-scheme: light;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--surface) !important;
  color: var(--text) !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}
html:not(.dark) body,
html:not(.dark) [class~="bg-gray-50"] { background-color: var(--bg) !important; }
html:not(.dark) [class~="bg-white"] { background-color: var(--surface) !important; }
html:not(.dark) [class~="bg-gray-100"] { background-color: var(--surface-2) !important; }
html:not(.dark) [class~="border-gray-200"],
html:not(.dark) [class~="border-gray-300"] { border-color: var(--border) !important; }
html:not(.dark) .cc-card { background: var(--surface) !important; border-color: var(--border) !important; }
html:not(.dark) .ws-select-btn { background: var(--surface-2) !important; border-color: var(--border) !important; }

/* ============================================================
   PREMIUM SCALE — applies to EVERY page that loads this stylesheet
   (app pages, incl. no-sidebar views like dashboard.html), BOTH themes.
   All values reference design tokens (see design-tokens.css / DESIGN.md).
   ============================================================ */
body { font-size: var(--text-base); letter-spacing: -0.004em; }
body .text-2xl { font-size: var(--text-xl) !important; letter-spacing: -0.02em; }
body .text-xl  { font-size: var(--text-lg) !important; letter-spacing: -0.012em; }
body .text-base { font-size: var(--text-base) !important; }
body .font-bold { font-weight: var(--fw-semibold) !important; }
body [class~="rounded-xl"] { border-radius: var(--radius-lg) !important; }
body [class~="rounded-lg"] { border-radius: var(--radius) !important; }
body [class~="shadow-lg"], body [class~="shadow-xl"] { box-shadow: var(--shadow-sm) !important; }
body [class~="py-12"] { padding-top: 1.75rem !important; padding-bottom: 1.75rem !important; }

/* primary buttons: compact + flat (both themes) */
body [class~="bg-indigo-600"] {
  padding: 0.5rem 0.95rem !important; font-size: var(--text-base) !important; font-weight: var(--fw-semibold) !important;
  border-radius: var(--radius) !important; box-shadow: none !important;
}
body [class~="bg-indigo-600"] svg { width: 1rem !important; height: 1rem !important; }
body [class~="bg-indigo-600"]:hover { transform: none !important; box-shadow: var(--shadow-sm) !important; }

/* gradient CTA buttons/links (e.g. "Turn into Dashboard") — compact + flat, keep the gradient */
body button[class*="bg-gradient"], body a[class*="bg-gradient"] {
  padding: 0.5rem 0.95rem !important; font-size: var(--text-base) !important; font-weight: var(--fw-semibold) !important;
  border-radius: var(--radius) !important; box-shadow: none !important;
}
body button[class*="bg-gradient"]:hover, body a[class*="bg-gradient"]:hover { transform: none !important; filter: brightness(0.97); }
body button[class*="bg-gradient"] svg, body a[class*="bg-gradient"] svg { width: 1rem !important; height: 1rem !important; }

/* denser sidebar (both themes) */
.sidebar-nav-item { padding: 0.5rem 0.75rem !important; font-size: var(--text-sm) !important; gap: 0.625rem !important; }
.sidebar-nav-item svg { width: 18px !important; height: 18px !important; }

/* dashboards empty-state -> compact centered block (both themes) */
#noDashboards, #noTemplates, #noShares { max-width: 440px !important; margin: 1.5rem auto 0 !important; padding: 1.75rem !important; border-width: 1px !important; }
#noDashboards > svg, #noTemplates > svg, #noShares > svg { width: 2.25rem !important; height: 2.25rem !important; }

/* tabs: kill stray focus rectangle (both themes) */
#myDashboardsTab, #templatesTab, #sharedLinksTab { font-size: var(--text-base) !important; }
#myDashboardsTab:focus, #templatesTab:focus, #sharedLinksTab:focus,
#myDashboardsTab:focus-visible, #templatesTab:focus-visible, #sharedLinksTab:focus-visible { outline: none !important; box-shadow: none !important; }

/* secondary buttons — token-driven, works in BOTH themes via .dark token overrides */
#noDashboards [class~="bg-indigo-600"], #noTemplates [class~="bg-indigo-600"], #noShares [class~="bg-indigo-600"] {
  background: transparent !important; color: var(--accent-text) !important; border: 1px solid var(--border-strong) !important;
}
#propertySelectionModal [id*="ConnectButton"] {
  background: var(--accent-soft) !important; color: var(--accent-text) !important; border: 1px solid var(--accent-border) !important; box-shadow: none !important;
}
#propertySelectionModal [id*="ConnectButton"]:hover { filter: brightness(0.97); }
