/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #475569;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.leads-toolbar-shell {
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 30px -26px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow-x: visible !important;
}

.dark .leads-toolbar-shell {
    border-color: rgba(75, 85, 99, 0.9);
    background: rgba(31, 41, 55, 0.92);
}

.leads-toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    justify-content: space-between;
    gap: 0.9rem 1.25rem;
    min-width: 0;
    padding: 0.85rem 1rem;
}

.leads-toolbar-nav,
.leads-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.leads-toolbar-nav {
    flex-wrap: wrap;
    align-items: flex-start;
    min-width: 0;
    max-height: 7.25rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.1rem 0.25rem 0.1rem 0;
}

.leads-toolbar-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.leads-toolbar-controls {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.leads-toolbar-context {
    display: none !important;
}

.pipeline-tab,
.leads-toolbar-btn,
.leads-view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.pipeline-tab {
    border-width: 1px !important;
    border-style: solid;
    border-radius: 0.95rem;
    padding: 0.8rem 1rem;
    background: transparent;
    min-width: max-content;
}

.pipeline-tab:hover {
    background: rgba(15, 23, 42, 0.045);
    transform: translateY(-1px);
}

.dark .pipeline-tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

.pipeline-tab.active {
    background: rgba(16, 185, 129, 0.12);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.08);
}

.leads-toolbar-btn {
    border: 1px solid #e5e7eb;
    border-radius: 0.95rem;
    padding: 0.8rem 1rem;
}

.leads-toolbar-btn-muted {
    background: rgba(255, 255, 255, 0.96);
    color: #334155;
}

.leads-toolbar-btn-muted:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.dark .leads-toolbar-btn {
    border-color: #4b5563;
}

.dark .leads-toolbar-btn-muted {
    background: rgba(31, 41, 55, 0.95);
    color: #e5e7eb;
}

.dark .leads-toolbar-btn-muted:hover {
    background: #374151;
}

.leads-toolbar-btn-primary {
    border-color: transparent;
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 12px 24px -18px rgba(5, 150, 105, 0.85);
}

.leads-toolbar-btn-primary:hover {
    background: #059669;
    transform: translateY(-1px);
}

@media (max-width: 1024px) {
    .leads-toolbar-row {
        grid-template-columns: 1fr;
    }

    .leads-toolbar-actions {
        justify-content: flex-start;
    }

    .leads-toolbar-controls {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .leads-toolbar-nav {
        max-height: 10.5rem;
    }

    .pipeline-tab {
        flex: 1 1 calc(50% - 0.625rem);
        min-width: 8.5rem;
        padding: 0.72rem 0.85rem;
    }
}

.leads-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: #f8fafc;
}

.dark .leads-view-toggle {
    border-color: #4b5563;
    background: #1f2937;
}

.leads-view-toggle-btn {
    border: none;
    border-radius: 0.8rem;
    padding: 0.56rem 0.9rem;
    color: #6b7280;
    background: transparent;
}

.leads-view-toggle-btn:hover {
    color: #1f2937;
}

.dark .leads-view-toggle-btn {
    color: #9ca3af;
}

.dark .leads-view-toggle-btn:hover {
    color: #f3f4f6;
}

.leads-view-toggle-btn.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 10px 20px -18px rgba(15, 23, 42, 0.5);
}

.dark .leads-view-toggle-btn.active {
    background: #374151;
    color: #f9fafb;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animation-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Base list hover scrollbar */
#base-list::-webkit-scrollbar {
    width: 4px;
}

#base-list::-webkit-scrollbar-thumb {
    background: transparent;
}

#base-list:hover::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

.dark #base-list:hover::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Kanban column styles */
.kanban-column {
    transition: all 0.2s ease;
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Premium Gradients & Glassmorphism */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass-effect {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(to right, #10b981, #3b82f6);
}

/* Sidebar Hover & Active states */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background-color: #10b981;
    transform: scaleY(0);
    transition: transform 0.2s ease-in-out;
}

.nav-item:hover::before,
.nav-item.active::before {
    transform: scaleY(1);
}

/* Card Hover Elevation */
.hover-elevate {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-elevate:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* --- GOOGLE CALENDAR STYLING OVERRIDES --- */

/* Remove bold borders and use lighter gray */
.fc-theme-standard td,
.fc-theme-standard th {
    border-color: #dadce0 !important;
}

div.fc-scrollgrid {
    border: none !important;
}

.fc-scrollgrid-section-header>th {
    border: none !important;
}

/* Header Toolbar Styling */
.fc-toolbar {
    margin-bottom: 24px !important;
    padding: 8px 0;
}

.fc-toolbar-title {
    font-size: 22px !important;
    font-weight: 400 !important;
    margin-left: 12px !important;
}

/* Adapt colors for dark mode */
.dark .fc-toolbar-title,
.dark .fc-col-header-cell-cushion,
.dark .fc-timegrid-slot-label-cushion,
.dark .fc-daygrid-day-number {
    color: #e5e7eb !important;
    /* gray-200 */
}

/* Today Button */
.fc .fc-button-primary {
    background-color: transparent !important;
    border: 1px solid #dadce0 !important;
    color: #3c4043 !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    padding: 6px 16px !important;
    height: 36px !important;
    text-transform: capitalize !important;
    box-shadow: none !important;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.dark .fc .fc-button-primary {
    border-color: #4b5563 !important;
    /* gray-600 */
    color: #e5e7eb !important;
    /* gray-200 */
}

.fc .fc-button-primary:hover {
    background-color: #f1f3f4 !important;
    color: #202124 !important;
}

.dark .fc .fc-button-primary:hover {
    background-color: #374151 !important;
    /* gray-700 */
    color: #f9fafb !important;
    /* gray-50 */
}

.fc .fc-button-primary:focus {
    box-shadow: none !important;
}

/* Prev/Next Buttons */
.fc .fc-prev-button,
.fc .fc-next-button {
    border: none !important;
    background-color: transparent !important;
    color: #5f6368 !important;
    padding: 8px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.dark .fc .fc-prev-button,
.dark .fc .fc-next-button {
    color: #9ca3af !important;
    /* gray-400 */
}

.fc .fc-prev-button:hover,
.fc .fc-next-button:hover {
    background-color: #f1f3f4 !important;
    color: #202124 !important;
}

.dark .fc .fc-prev-button:hover,
.dark .fc .fc-next-button:hover {
    background-color: #374151 !important;
    color: #f9fafb !important;
}

.fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
}

/* View Group Buttons (Day, Week, Month) */
.fc .fc-button-group {
    background-color: transparent !important;
}

.fc .fc-button-group>.fc-button {
    border-radius: 4px !important;
    margin-left: -1px;
    /* Remove double borders */
}

.fc .fc-button-group>.fc-button:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.fc .fc-button-group>.fc-button:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.fc .fc-button-group>.fc-button:not(:first-child):not(:last-child) {
    border-radius: 0 !important;
}

.fc .fc-button-active {
    background-color: #e8f0fe !important;
    /* Light blue */
    color: #1967d2 !important;
    border-color: #1967d2 !important;
    z-index: 2 !important;
}

.dark .fc .fc-button-active {
    background-color: rgba(59, 130, 246, 0.2) !important;
    /* blue-500/20 */
    color: #60a5fa !important;
    /* blue-400 */
    border-color: #3b82f6 !important;
    /* blue-500 */
}

/* Day Headers (Mon, Tue, Wed) */
.fc-col-header-cell-cushion {
    color: #70757a !important;
    font-weight: 500 !important;
    text-transform: uppercase;
    font-size: 11px !important;
    padding: 8px 0 !important;
    text-decoration: none !important;
}

/* Today Highlight in Header */
.fc-day-today .fc-col-header-cell-cushion {
    color: #1a73e8 !important;
    /* Google Blue */
}

.dark .fc-day-today .fc-col-header-cell-cushion {
    color: #60a5fa !important;
    /* blue-400 */
}

/* Time Grid specific today highlight (the day number circle) */
.fc-timegrid-col.fc-day-today .fc-col-header-cell-cushion {
    background-color: #1a73e8;
    color: white !important;
    border-radius: 50%;
    height: 46px;
    width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-top: 4px;
    font-size: 20px !important;
    font-weight: 400 !important;
}

.dark .fc-timegrid-col.fc-day-today .fc-col-header-cell-cushion {
    background-color: #3b82f6;
}

/* Time Labels (e.g., 9 AM) */
.fc-timegrid-slot-label-cushion {
    font-size: 10px !important;
    color: #70757a !important;
    text-transform: lowercase;
    font-weight: 400 !important;
    padding-right: 8px !important;
}

/* Events Styling */
.fc-event {
    border: none !important;
    border-radius: 4px !important;
    padding: 1px 4px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2) !important;
    /* Subtle inner border */
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s;
}

.fc-event:hover {
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3) !important;
}

.dark .fc-event:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.fc-v-event .fc-event-main {
    padding: 2px !important;
}

.fc-v-event .fc-event-time {
    font-weight: 400;
    font-size: 11px;
    margin-bottom: 2px;
    opacity: 0.9;
}

.fc-v-event .fc-event-title {
    font-weight: 500;
}

/* Current Time Indicator (Red line) */
.fc-timegrid-now-indicator-line {
    border-color: #ea4335 !important;
    border-width: 2px 0 0 !important;
    z-index: 4 !important;
}

.fc-timegrid-now-indicator-arrow {
    border-color: #ea4335 !important;
    border-width: 5px 0 5px 6px !important;
    border-top-color: transparent !important;
    border-bottom-color: transparent !important;
    margin-top: -4px !important;
}

/* Day Grid (Month View) Specifics */
.fc-daygrid-day-number {
    color: #3c4043 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 4px 8px !important;
    text-decoration: none !important;
    margin-top: 2px;
}

.fc-daygrid-day.fc-day-today {
    background-color: transparent !important;
}

.fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background-color: #1a73e8 !important;
    color: white !important;
    border-radius: 50%;
    height: 24px;
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin-right: 4px;
}

.dark .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background-color: #3b82f6 !important;
}

/* Remove weekend background color */
.fc-day-sat,
.fc-day-sun {
    background-color: transparent !important;
}

/* Minor grid lines */
.fc-timegrid-slot-minor {
    border-top-style: none !important;
}

.fc-theme-standard .fc-scrollgrid {
    border: 1px solid #dadce0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.dark .fc-theme-standard td,
.dark .fc-theme-standard th,
.dark .fc-theme-standard .fc-scrollgrid {
    border-color: #374151 !important;
    /* gray-700 */
}

/* --- COLLAPSIBLE SIDEBAR --- */
body.sidebar-collapsed #sidebar {
    width: 5rem !important;
    /* 80px (w-20 from tailwind) */
}

body.sidebar-collapsed .sidebar-text {
    display: none !important;
}

body.sidebar-collapsed .nav-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

body.sidebar-collapsed .nav-item i {
    font-size: 1.25rem !important;
    /* Slightly larger icons when collapsed */
    margin: 0 !important;
}

#sidebar .sidebar-logo-full + img {
    display: none;
}

#sidebar .h-16 .sidebar-text {
    display: none;
}

body.sidebar-collapsed #sidebar .sidebar-logo-full {
    display: none !important;
}

body.sidebar-collapsed #sidebar .sidebar-logo-full + img {
    display: block !important;
}

body.sidebar-collapsed #sidebar .h-16.flex.items-center.px-6 {
    justify-content: center !important;
    padding: 0 !important;
}

body.sidebar-collapsed #sidebar .h-16.flex.items-center.px-6 i {
    font-size: 1.5rem !important;
    margin: 0 !important;
}
/* Admin event template editor */
.event-template-input {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    color: #1f2937;
    outline: none;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.event-template-input:focus {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.dark .event-template-input {
    border-color: #374151;
    background: #111827;
    color: #f3f4f6;
}

/* ============================================================= */
/* GLOBAL UI POLISH — app-wide, additive, layout-safe            */
/* ============================================================= */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Modern thin scrollbars across the whole app */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.dark * {
    scrollbar-color: #475569 transparent;
}

*::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    background-clip: padding-box;
}

.dark *::-webkit-scrollbar-thumb {
    background: #475569;
    background-clip: padding-box;
}

.dark *::-webkit-scrollbar-thumb:hover {
    background: #64748b;
    background-clip: padding-box;
}

/* On-brand text selection */
::selection {
    background: rgba(16, 185, 129, 0.22);
}

/* Accessible, on-brand focus ring (keyboard navigation only) */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid rgba(16, 185, 129, 0.6);
    outline-offset: 2px;
}

/* Subtle, consistent micro-interactions on actionable elements */
button,
[role="button"],
a.nav-item {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}

button:active,
[role="button"]:active {
    transform: translateY(1px);
}

input,
select,
textarea {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

/* Opt-in card elevation helper reusable across pages */
.ui-card {
    transition: transform .25s cubic-bezier(.4, 0, .2, 1), box-shadow .25s cubic-bezier(.4, 0, .2, 1);
}

.ui-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px -24px rgba(15, 23, 42, .45);
}

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    button:active,
    [role="button"]:active,
    .ui-card:hover {
        transform: none;
    }
}
