/* Model Research — app.css */
/* No @apply — we're using Tailwind CDN which doesn't support it */

/* ── Brand variables ── */
:root {
    --color-primary: #297e61;
    --color-primary-dark: #1d5844;
    --color-primary-light: #73b5a7;
    --color-primary-subtle: #c9e4db;
    --color-bg: #f5f9f8;
    --color-surface: #ffffff;
    --color-dark: #0f172a;
    --color-light-text: #e8f0ee;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #2563eb;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-skeleton: #f3f4f6;
    --color-skeleton-shimmer: #e5e7eb;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Brand utility classes (Tailwind CDN can't extend colours) ── */
/* Background */
.bg-brand { background-color: var(--color-primary); }
.bg-brand-dark { background-color: var(--color-primary-dark); }
.bg-brand-light { background-color: var(--color-primary-light); }
.bg-brand-subtle { background-color: var(--color-primary-subtle); }
.bg-brand-subtle0 { background-color: var(--color-primary-subtle); }
.bg-brand-50 { background-color: #f0f7f4; }
.bg-brand-100 { background-color: var(--color-primary-subtle); }
.bg-brand-500 { background-color: #34966f; }
/* Text */
.text-brand { color: var(--color-primary); }
.text-brand-dark { color: var(--color-primary-dark); }
.text-brand-light { color: var(--color-primary-light); }
.text-brand-200 { color: #a3d4c3; }
.text-brand-400 { color: var(--color-primary-light); }
.text-brand-500 { color: #34966f; }
.text-brand-700 { color: var(--color-primary-dark); }
/* Border */
.border-brand { border-color: var(--color-primary); }
.border-brand-dark { border-color: var(--color-primary-dark); }
.border-brand-light { border-color: var(--color-primary-light); }
.border-brand-500 { border-color: #34966f; }
/* Ring / Focus */
.ring-brand { --tw-ring-color: var(--color-primary); }
.focus\:ring-brand:focus { --tw-ring-color: var(--color-primary); }
.focus\:ring-brand-400:focus { --tw-ring-color: var(--color-primary-light); }
.focus\:border-brand:focus { border-color: var(--color-primary); }
/* Hover */
.hover\:bg-brand:hover { background-color: var(--color-primary); }
.hover\:bg-brand-dark:hover { background-color: var(--color-primary-dark); }
.hover\:bg-brand-subtle:hover { background-color: var(--color-primary-subtle); }
.hover\:text-brand:hover { color: var(--color-primary); }
.hover\:text-brand-dark:hover { color: var(--color-primary-dark); }
/* Extended shades */
.bg-brand-200 { background-color: #a3d4c3; }
.bg-brand-300 { background-color: #7ac0a8; }
.bg-brand-800 { background-color: var(--color-primary-dark); }
.bg-brand-900 { background-color: #153d2f; }
.text-brand-100 { color: var(--color-primary-subtle); }
.text-brand-300 { color: #7ac0a8; }
.text-brand-800 { color: #1a4c38; }
.text-brand-900 { color: #153d2f; }
.border-brand-200 { border-color: #a3d4c3; }
.border-brand-300 { border-color: #7ac0a8; }
.border-brand-400 { border-color: var(--color-primary-light); }
.border-brand-800 { border-color: #1a4c38; }
.hover\:text-brand-300:hover { color: #7ac0a8; }
.hover\:bg-brand-50:hover { background-color: #f0f7f4; }
.placeholder-brand-400::placeholder { color: var(--color-primary-light); }
/* Group hover */
.group:hover .group-hover\:text-brand { color: var(--color-primary); }
.focus\:ring-brand:focus { --tw-ring-color: var(--color-primary); }
.focus\:border-brand:focus { border-color: var(--color-primary); }

/* Sidebar links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: #9CA3AF;
    transition: all 0.15s ease;
}
.sidebar-link:hover {
    background: #1F2937;
    color: #F9FAFB;
}
.sidebar-link.active {
    background: var(--color-primary);
    color: #FFFFFF;
}

/* HTMX loading */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }

/* Skeleton loading */
.skeleton {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background: #E5E7EB;
    border-radius: 0.25rem;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Smooth transitions */
a, button { transition: all 0.15s ease; }

/* Cards */
.card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 1.25rem;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: var(--color-primary-light);
}

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px 0 0 3px;
}

/* Table base */
.data-table {
    width: 100%;
    font-size: 0.8125rem;
}
.data-table th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #E5E7EB;
    text-align: left;
}
.data-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #F3F4F6;
}
.data-table tbody tr:hover {
    background: #F9FAFB;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
}
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-gray { background: #F3F4F6; color: #374151; }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* Tool icon wrapper */
.tool-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

/* Form inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], input[type="number"],
textarea, select {
    font-size: 0.8125rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    width: 100%;
    transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(41, 126, 97, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border: none;
}
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #D1D5DB;
}
.btn-secondary:hover { background: #F9FAFB; border-color: #9CA3AF; }

/* Tabs */
.tab-btn {
    cursor: pointer;
    background: none;
    outline: none;
}
.tab-btn:focus { outline: none; }

/* Model picker cards */
.model-card {
    transition: all 0.15s ease;
}

/* Chevron rotation */
.chevron { transition: transform 0.2s ease; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}
.page-header p {
    font-size: 0.8125rem;
    color: #6B7280;
    margin-top: 0.125rem;
}

/* ── Public site ── */
.public-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
}
.public-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    transition: color 0.15s;
}
.public-nav-link:hover { color: #111827; }
.public-nav-link.active { color: var(--color-primary); }
.public-footer {
    background: #111827;
}
.hero-gradient {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
}

/* ── App horizontal header ── */
.app-header {
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    position: relative;
    z-index: 40;
}
.app-nav-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6B7280;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
}
.app-nav-link:hover {
    color: #111827;
    background: #F3F4F6;
}
.app-nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-subtle);
}
.switcher-btn {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6B7280;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #E5E7EB;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
}
.switcher-btn:hover {
    border-color: #9CA3AF;
    color: #374151;
}
.switcher-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 50;
    min-width: 200px;
}

/* ── Prose: rendered blog/article HTML ── */
.prose h1 { font-size: 2rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: #111827; }
.prose h2 { font-size: 1.5rem; font-weight: 600; margin: 1.25rem 0 0.625rem; color: #111827; }
.prose h3 { font-size: 1.25rem; font-weight: 600; margin: 1rem 0 0.5rem; color: #111827; }
.prose h4 { font-size: 1.125rem; font-weight: 600; margin: 1rem 0 0.5rem; color: #374151; }
.prose p { margin: 0 0 1rem; line-height: 1.75; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-bottom: 0.25rem; line-height: 1.75; }
.prose a { color: var(--color-primary); text-decoration: underline; }
.prose a:hover { color: var(--color-primary-dark); }
.prose blockquote {
    border-left: 4px solid #E5E7EB;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: #6B7280;
    font-style: italic;
    background: #F9FAFB;
    border-radius: 0 0.375rem 0.375rem 0;
}
.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}
.prose table th,
.prose table td {
    border: 1px solid #E5E7EB;
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.prose table th {
    background: #F9FAFB;
    font-weight: 600;
    color: #374151;
}
.prose pre {
    background: #1F2937;
    color: #E5E7EB;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.875rem;
    line-height: 1.5;
}
.prose code {
    background: #F3F4F6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #DC2626;
}
.prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.prose hr {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 2rem 0;
}

/* ── Toast notifications ── */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 24rem;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    pointer-events: auto;
    animation: toast-in 0.25s ease-out;
    max-width: 100%;
}
.toast-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.toast-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.toast-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.toast-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.toast-dismiss {
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0 0.25rem;
}
.toast-dismiss:hover { opacity: 1; }
.toast.hiding {
    animation: toast-out 0.25s ease-in forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(1rem); }
}

/* ── Confirm modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 0.15s ease-out;
}
.modal-backdrop.hiding {
    animation: modal-fade-out 0.15s ease-in forwards;
}
.modal-content {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    max-width: 28rem;
    width: 90%;
    padding: 1.5rem;
    animation: modal-scale-in 0.15s ease-out;
}
.modal-backdrop.hiding .modal-content {
    animation: modal-scale-out 0.15s ease-in forwards;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes modal-scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes modal-scale-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }

/* ── Typography ── */
body, input, textarea, select, button {
    font-family: var(--font-sans);
}
code, pre, .font-mono {
    font-family: var(--font-mono);
}

/* ── Responsive sidebar ── */
.app-sidebar {
    width: 240px;
    transition: width 0.2s ease, transform 0.2s ease;
}
@media (max-width: 1023px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 45;
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 44;
    }
    .sidebar-overlay.open {
        display: block;
    }
    .main-content {
        margin-left: 0 !important;
    }
}

/* ── Content area ── */
.content-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}
@media (max-width: 767px) {
    .content-wrapper {
        padding: 1rem;
    }
}

/* ── Prefers reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .skeleton {
        animation: none !important;
        opacity: 0.7;
    }
}