/* Agentpulse - Utilitarian Styles */

/* ================================
   Base & Typography
   ================================ */

@layer base {
    html {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    body {
        font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    }
}

/* ================================
   Custom Scrollbars
   ================================ */

.board-scroll {
    scrollbar-width: thin;
    scrollbar-color: #3f3f46 transparent;
}

.board-scroll::-webkit-scrollbar {
    height: 8px;
}

.board-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.board-scroll::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 2px;
}

.board-scroll::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

.column-scroll {
    scrollbar-width: thin;
    scrollbar-color: #27272a transparent;
}

.column-scroll::-webkit-scrollbar {
    width: 6px;
}

.column-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.column-scroll::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 2px;
}

.column-scroll::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* ================================
   Kanban Column Styles
   ================================ */

.kanban-column {
    min-height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
}

/* Collapsed column label - rotated 90 degrees */
.collapsed-column-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .kanban-column {
        width: 85vw;
        min-width: 300px;
    }
}

/* ================================
   Task Card Styles
   ================================ */

.task-card:hover {
    border-color: #52525b;
}

/* Line clamp for description */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Expanded card state */
.card-expanded {
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dark .card-expanded {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Card expand/collapse transition */
.task-card {
    transition: border-color 0.15s ease, box-shadow 0.2s ease;
}

/* ================================
   Card Animations (Subtle)
   ================================ */

@keyframes cardEnter {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.card-enter {
    animation: cardEnter 0.15s ease-out forwards;
}

@keyframes cardLeave {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.card-leave {
    animation: cardLeave 0.1s ease-in forwards;
}

.card-move {
    animation: cardEnter 0.2s ease-out forwards;
}

/* Highlight new or updated card */
@keyframes cardHighlight {
    0% {
        background-color: rgba(59, 130, 246, 0.15);
    }
    100% {
        background-color: transparent;
    }
}

.card-highlight {
    animation: cardHighlight 1s ease-out;
}

/* Glow effect for recently updated cards via WebSocket */
@keyframes cardGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4),
                    0 0 8px 2px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.2),
                    0 0 12px 4px rgba(59, 130, 246, 0.2);
    }
    100% {
        box-shadow: none;
    }
}

.card-glow {
    animation: cardGlow 1.5s ease-out forwards;
}

/* Dark mode glow uses a slightly brighter color */
.dark .card-glow {
    animation: cardGlowDark 1.5s ease-out forwards;
}

@keyframes cardGlowDark {
    0% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.5),
                    0 0 10px 3px rgba(96, 165, 250, 0.35);
    }
    50% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.25),
                    0 0 14px 5px rgba(96, 165, 250, 0.2);
    }
    100% {
        box-shadow: none;
    }
}

/* ================================
   Toast Notifications
   ================================ */

.toast {
    animation: toastEnter 0.2s ease-out;
}

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

.toast-exit {
    animation: toastExit 0.15s ease-in forwards;
}

@keyframes toastExit {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Toast variants - solid backgrounds */
.toast-success {
    background: #18181b;
    border-left: 3px solid #22c55e;
}

.toast-error {
    background: #18181b;
    border-left: 3px solid #ef4444;
}

.toast-info {
    background: #18181b;
    border-left: 3px solid #3b82f6;
}

.toast-warning {
    background: #18181b;
    border-left: 3px solid #f59e0b;
}

/* ================================
   Connection Status
   ================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-slow {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ================================
   Loading Skeleton
   ================================ */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #27272a 25%,
        #3f3f46 50%,
        #27272a 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 2px;
}

/* ================================
   Utilities
   ================================ */

[x-cloak] {
    display: none !important;
}

/* ================================
   Focus Styles
   ================================ */

button:focus-visible,
a:focus-visible {
    outline: 1px solid #3b82f6;
    outline-offset: 1px;
}

/* ================================
   Status Colors
   ================================ */

.status-waiting_prompt { --status-color: #f59e0b; }
.status-planning { --status-color: #3b82f6; }
.status-waiting_input { --status-color: #f97316; }
.status-implementing { --status-color: #8b5cf6; }
.status-testing { --status-color: #06b6d4; }
.status-finishing { --status-color: #22c55e; }

/* ================================
   Responsive Utilities
   ================================ */

@media (max-width: 640px) {
    .kanban-column {
        width: 100%;
        min-width: 280px;
    }

    .board-scroll {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ================================
   Prose / Markdown Styles
   ================================ */

/* Light mode (default) */
.prose {
    color: #27272a;
    line-height: 1.6;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: #18181b;
    font-weight: 600;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

.prose h1 { font-size: 1.375rem; }
.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.125rem; }
.prose h4, .prose h5, .prose h6 { font-size: 1rem; }

.prose p {
    margin-top: 0.75em;
    margin-bottom: 0.75em;
}

.prose a {
    color: #2563eb;
    text-decoration: none;
}

.prose a:hover {
    text-decoration: underline;
}

.prose strong {
    color: #18181b;
    font-weight: 600;
}

.prose em {
    font-style: italic;
}

.prose code {
    background: #f4f4f5;
    padding: 0.125rem 0.375rem;
    border-radius: 2px;
    font-size: 0.875em;
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    color: #18181b;
    border: 1px solid #e4e4e7;
}

.prose pre {
    background: #fafafa;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
    border: 1px solid #e4e4e7;
}

.prose pre code {
    background: transparent;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    border: none;
}

.prose ul, .prose ol {
    margin-top: 0.75em;
    margin-bottom: 0.75em;
    padding-left: 1.5em;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

.prose li > ul, .prose li > ol {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

.prose blockquote {
    border-left: 2px solid #e4e4e7;
    padding-left: 1rem;
    margin: 1em 0;
    color: #3f3f46;
}

.prose hr {
    border: none;
    border-top: 1px solid #e4e4e7;
    margin: 1.5em 0;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.875rem;
}

.prose th, .prose td {
    border: 1px solid #e4e4e7;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.prose th {
    background: #fafafa;
    font-weight: 600;
    color: #18181b;
}

.prose tbody tr:nth-child(even) {
    background: rgba(244, 244, 245, 0.5);
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1em 0;
    border: 1px solid #e4e4e7;
}

/* Dark mode overrides */
.dark .prose {
    color: #d4d4d8;
}

.dark .prose h1, .dark .prose h2, .dark .prose h3, .dark .prose h4, .dark .prose h5, .dark .prose h6 {
    color: #fafafa;
}

.dark .prose a {
    color: #60a5fa;
}

.dark .prose strong {
    color: #fafafa;
}

.dark .prose code {
    background: #27272a;
    color: #fafafa;
    border-color: #3f3f46;
}

.dark .prose pre {
    background: #18181b;
    border-color: #27272a;
}

.dark .prose blockquote {
    border-left-color: #3f3f46;
    color: #a1a1aa;
}

.dark .prose hr {
    border-top-color: #27272a;
}

.dark .prose th, .dark .prose td {
    border-color: #27272a;
}

.dark .prose th {
    background: #18181b;
    color: #fafafa;
}

.dark .prose tbody tr:nth-child(even) {
    background: rgba(39, 39, 42, 0.5);
}

.dark .prose img {
    border-color: #27272a;
}

/* ================================
   Print Styles
   ================================ */

@media print {
    .toast,
    #toast-container {
        display: none !important;
    }

    .kanban-column {
        page-break-inside: avoid;
    }
}
