/* css/base.css */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated background mesh for dark mode */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(124,111,247,0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 90%, rgba(0,206,201,0.05) 0%, transparent 55%),
        radial-gradient(ellipse 50% 60% at 60% 40%, rgba(253,121,168,0.04) 0%, transparent 50%);
    pointer-events: none;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(108,92,231,0.04) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 90%, rgba(0,206,201,0.03) 0%, transparent 55%);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: inherit;
    text-decoration: none;
}

input, button, select, textarea {
    font-family: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
}

/* ── Skip to content (accessibility) ── */
.skip-to-content {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 9999;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    transition: top 0.2s ease;
}
.skip-to-content:focus {
    top: 1rem;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.18);
}

/* ── App Layout ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Mobile header brand — hidden on desktop, shown on mobile via responsive.css */
.mobile-header-brand {
    display: none;
}

/* ═══════════════════════════════
   SIDEBAR
═══════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--glass-border);
    padding: 1.25rem 0.875rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    transition: width var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── Brand ── */
.brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.5rem 0.5rem 0.5rem 0.375rem;
    margin-bottom: 1.75rem;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-cyan) 100%);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.5px;
    box-shadow: 0 0 0 1px rgba(124,111,247,0.3), 0 0 20px rgba(124,111,247,0.4);
    flex-shrink: 0;
    position: relative;
    animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(124,111,247,0.3), 0 0 20px rgba(124,111,247,0.4); }
    50%       { box-shadow: 0 0 0 1px rgba(124,111,247,0.5), 0 0 30px rgba(124,111,247,0.55); }
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    line-height: 1.15;
}

[data-theme="light"] .brand-name {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar.collapsed .brand-name {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
    width: 0;
}

/* ── Nav Menu ── */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.125rem;
    scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.7rem 0.875rem;
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--primary-subtle), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
    border-radius: inherit;
}

.nav-item:hover {
    background: var(--glass-highlight-md);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, #5a4fd6 100%);
    color: white;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.nav-item.active::before {
    opacity: 0;
}

.nav-item i,
.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.nav-item:hover i,
.nav-item:hover svg {
    transform: scale(1.1);
}

.nav-item.active i,
.nav-item.active svg {
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.5));
}

.nav-item span {
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

/* Collapsed tooltip */
.sidebar.collapsed .nav-item {
    justify-content: center;
    position: relative;
}

.sidebar.collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15,17,26,0.95);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 300;
    pointer-events: none;
}

[data-theme="light"] .sidebar.collapsed .nav-item:hover::after {
    background: rgba(255,255,255,0.98);
}

/* ═══════════════════════════════
   MAIN CONTENT
═══════════════════════════════ */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
    min-width: 0;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ═══════════════════════════════
   HEADER
═══════════════════════════════ */
.app-header {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: 0;
}

/* Toggle sidebar button */
.toggle-sidebar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-sm);
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    color: var(--text-secondary);
}

.toggle-sidebar-btn:hover {
    border-color: var(--glass-border-focus);
    background: var(--primary-subtle);
    color: var(--primary-light);
    box-shadow: var(--border-glow-primary);
}

.toggle-sidebar-btn svg,
.toggle-sidebar-btn i {
    width: 18px;
    height: 18px;
}

/* Search bar */
.search-container {
    position: relative;
    width: 300px;
    max-width: 100%;
    flex-shrink: 1;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.375rem;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--primary-subtle);
    box-shadow: var(--border-glow-primary);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 15px;
    height: 15px;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Streak badge */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.875rem;
    background: var(--accent-coral-subtle);
    border: 1px solid rgba(255,118,117,0.3);
    color: var(--accent-coral);
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: default;
    white-space: nowrap;
}

.streak-badge svg,
.streak-badge i {
    width: 14px;
    height: 14px;
    animation: flamePulse 1.5s ease-in-out infinite;
}

@keyframes flamePulse {
    0%, 100% { transform: scale(1) rotate(-3deg); }
    50%       { transform: scale(1.2) rotate(3deg); }
}

/* Notification bell */
.notification-bell {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-sm);
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.notification-bell:hover {
    border-color: var(--glass-border-focus);
    color: var(--text-primary);
    background: var(--glass-highlight-md);
}

.notification-bell svg,
.notification-bell i {
    width: 17px;
    height: 17px;
}

.bell-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    animation: bellPulse 2s ease-in-out infinite;
}

@keyframes bellPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,82,82,0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(255,82,82,0); }
}

/* Theme toggle */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-sm);
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.theme-toggle:hover {
    border-color: var(--accent-gold-glow);
    background: var(--accent-gold-subtle);
    color: var(--accent-gold);
}

.theme-toggle svg,
.theme-toggle i {
    width: 17px;
    height: 17px;
}

/* User profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.25rem 0.25rem 0.25rem 0;
    cursor: pointer;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
}

.user-profile:hover {
    opacity: 0.85;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-circle);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-rose) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(124,111,247,0.3);
    transition: box-shadow var(--transition-fast);
}

.user-profile:hover .user-avatar {
    box-shadow: 0 0 0 2px rgba(124,111,247,0.6), 0 0 12px rgba(124,111,247,0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 700;
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════
   CONTENT BODY
═══════════════════════════════ */
.content-body {
    flex-grow: 1;
    padding: var(--space-2xl);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* Pipeline board — clips inside, not outside */
#view-pipeline {
    overflow-x: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.view-container {
    display: none;
    animation: viewFadeIn var(--transition-normal) both;
    width: 100%;
    max-width: 100%;
}

.view-container.active {
    display: block;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Notifications Dropdown ── */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 300;
    display: none;
    overflow: hidden;
    animation: dropdownSlide var(--transition-fast) both;
}

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

.notifications-dropdown.open {
    display: block;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.875rem;
    font-weight: 700;
}

.dropdown-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 0.5rem;
}
