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

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    :root {
        --background: 0 0% 98%;
        --foreground: 0 0% 7%;
        --card: 0 0% 100%;
        --card-foreground: 0 0% 7%;
        --popover: 0 0% 100%;
        --popover-foreground: 0 0% 7%;
        --primary: 0 0% 7%;
        --primary-foreground: 0 0% 98%;
        --secondary: 0 0% 95%;
        --secondary-foreground: 0 0% 20%;
        --muted: 0 0% 94%;
        --muted-foreground: 0 0% 45%;
        --accent: 24 95% 53%;
        --accent-foreground: 0 0% 100%;
        --success: 142 71% 45%;
        --success-foreground: 0 0% 100%;
        --warning: 38 92% 50%;
        --warning-foreground: 0 0% 7%;
        --destructive: 0 84% 60%;
        --destructive-foreground: 0 0% 98%;
        --border: 0 0% 91%;
        --input: 0 0% 91%;
        --ring: 0 0% 7%;
        --radius: 0.875rem;
    }

    * {
        @apply border-border;
    }

    body {
        @apply bg-background text-foreground antialiased;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    body.mobile-floating-nav-pad {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        letter-spacing: -0.025em;
    }
}

@layer utilities {
    /** Fixed dialog max height: dvh avoids mobile browser chrome clipping; vh fallback for older engines. */
    .collab-modal-panel {
        max-height: calc(100vh - 2rem);
    }

    @supports (height: 100dvh) {
        .collab-modal-panel {
            max-height: calc(100dvh - 1.5rem);
        }
    }

    /** Scroll region inside fixed-height dialogs (flex child needs min-h-0 + overflow). */
    .dialog-body-scroll {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    /** Collab / board cards — aligned with settings & profile surfaces. */
    .glass-card {
        @apply border border-border/60 bg-card/95 text-card-foreground shadow-sm ring-1 ring-black/[0.04] backdrop-blur-sm transition-[box-shadow,border-color,background-color] duration-200 dark:bg-card/90 dark:ring-white/[0.06];
    }

    /** Kanban column shell behind stacked cards. */
    .board-column-surface {
        @apply rounded-2xl border border-border/60 bg-secondary/25 shadow-sm ring-1 ring-black/[0.03] backdrop-blur-sm dark:bg-secondary/15 dark:ring-white/[0.05];
    }

    .status-dot {
        @apply h-2 w-2 shrink-0 rounded-full ring-2 ring-background;
    }

    .drag-over-highlight {
        @apply bg-accent/5 ring-2 ring-accent/35;
    }
}

.card-stagger > *:nth-child(1) {
    animation-delay: 0ms;
}
.card-stagger > *:nth-child(2) {
    animation-delay: 40ms;
}
.card-stagger > *:nth-child(3) {
    animation-delay: 80ms;
}
.card-stagger > *:nth-child(4) {
    animation-delay: 120ms;
}
.card-stagger > *:nth-child(5) {
    animation-delay: 160ms;
}
.card-stagger > *:nth-child(6) {
    animation-delay: 200ms;
}
.card-stagger > *:nth-child(7) {
    animation-delay: 240ms;
}
.card-stagger > *:nth-child(8) {
    animation-delay: 280ms;
}
.card-stagger > *:nth-child(9) {
    animation-delay: 320ms;
}
.card-stagger > *:nth-child(10) {
    animation-delay: 360ms;
}

.app-toast-enter {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
    transition:
        opacity 220ms ease,
        transform 220ms ease;
}

.app-toast-enter.app-toast-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@keyframes saved-ring {
    0% {
        box-shadow: 0 0 0 0 hsl(var(--accent) / 0.45);
    }
    100% {
        box-shadow: 0 0 0 14px hsl(var(--accent) / 0);
    }
}

.animate-saved-ring {
    animation: saved-ring 1.15s ease-out both;
}

.pwa-pull-indicator--active svg {
    transform: rotate(180deg);
    @apply text-accent;
    transition: transform 180ms ease, color 180ms ease;
}

.touch-manipulation {
    touch-action: manipulation;
}
