/* =============================================================================
 * Abide AI Governance — Tailwind Compatibility Layer
 * 
 * Maps the ~180 Tailwind utility classes used in policy-builder.html and
 * policy-management.html so we can drop the cdn.tailwindcss.com <script>.
 *
 * This is a bridge file — future refactors can migrate to semantic classes
 * in styles.css. For now, zero HTML changes required.
 * ============================================================================= */

/* ---------------------------------------------------------------------------
 * Layout
 * --------------------------------------------------------------------------- */
.flex          { display: flex; }
.inline        { display: inline; }
.inline-block  { display: inline-block; }
.block         { display: block; }
.hidden        { display: none; }
.grid          { display: grid; }

.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.divide-y > * + *       { border-top: 1px solid; }
.divide-slate-700 > * + * { border-color: #334155; }

/* ---------------------------------------------------------------------------
 * Positioning
 * --------------------------------------------------------------------------- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.inset-0  { inset: 0; }
.top-0    { top: 0; }
.top-5    { top: 1.25rem; }
.bottom-6 { bottom: 1.5rem; }
.right-6  { right: 1.5rem; }
.left-\[60px\]               { left: 60px; }
.right-\[60px\]              { right: 60px; }
.left-\[calc\(33\%\+30px\)\]  { left: calc(33% + 30px); }
.right-\[calc\(33\%\+30px\)\] { right: calc(33% + 30px); }
.left-\[calc\(66\%\+30px\)\]  { left: calc(66% + 30px); }
.right-\[calc\(66\%\+30px\)\] { right: calc(66% + 30px); }

.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* ---------------------------------------------------------------------------
 * Sizing
 * --------------------------------------------------------------------------- */
.w-2    { width: 0.5rem; }
.w-3    { width: 0.75rem; }
.w-4    { width: 1rem; }
.w-5    { width: 1.25rem; }
.w-6    { width: 1.5rem; }
.w-7    { width: 1.75rem; }
.w-8    { width: 2rem; }
.w-10   { width: 2.5rem; }
.w-12   { width: 3rem; }
.w-14   { width: 3.5rem; }
.w-20   { width: 5rem; }
.w-64   { width: 16rem; }
.w-full { width: 100%; }

.h-0\.5 { height: 0.125rem; }
.h-2    { height: 0.5rem; }
.h-3    { height: 0.75rem; }
.h-4    { height: 1rem; }
.h-5    { height: 1.25rem; }
.h-6    { height: 1.5rem; }
.h-7    { height: 1.75rem; }
.h-8    { height: 2rem; }
.h-10   { height: 2.5rem; }
.h-12   { height: 3rem; }
.h-14   { height: 3.5rem; }

.min-h-screen            { min-height: 100vh; }
.min-h-\[60px\]          { min-height: 60px; }
.min-w-\[100px\]         { min-width: 100px; }
.min-w-\[140px\]         { min-width: 140px; }

.max-w-md  { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-7xl { max-width: 80rem; }

.max-h-\[80vh\]              { max-height: 80vh; }
.max-h-\[90vh\]              { max-height: 90vh; }
.max-h-\[calc\(80vh-80px\)\] { max-height: calc(80vh - 80px); }

/* ---------------------------------------------------------------------------
 * Spacing — Padding
 * --------------------------------------------------------------------------- */
.p-1  { padding: 0.25rem; }
.p-2  { padding: 0.5rem; }
.p-3  { padding: 0.75rem; }
.p-4  { padding: 1rem; }
.p-5  { padding: 1.25rem; }
.p-6  { padding: 1.5rem; }
.p-8  { padding: 2rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem;  padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem;    padding-right: 1rem; }
.px-6 { padding-left: 1.5rem;  padding-right: 1.5rem; }
.px-8 { padding-left: 2rem;    padding-right: 2rem; }

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1    { padding-top: 0.25rem;  padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2    { padding-top: 0.5rem;   padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3    { padding-top: 0.75rem;  padding-bottom: 0.75rem; }
.py-4    { padding-top: 1rem;     padding-bottom: 1rem; }
.py-6    { padding-top: 1.5rem;   padding-bottom: 1.5rem; }
.py-8    { padding-top: 2rem;     padding-bottom: 2rem; }

/* ---------------------------------------------------------------------------
 * Spacing — Margin
 * --------------------------------------------------------------------------- */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mr-1    { margin-right: 0.25rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---------------------------------------------------------------------------
 * Typography
 * --------------------------------------------------------------------------- */
.text-xs  { font-size: 0.75rem;  line-height: 1rem; }
.text-sm  { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg  { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl  { font-size: 1.25rem;  line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem;   line-height: 2rem; }
.text-4xl { font-size: 2.25rem;  line-height: 2.5rem; }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-center { text-align: center; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------------------
 * Colors — Text (Slate palette) — contrast-boosted for readability
 * --------------------------------------------------------------------------- */
.text-white      { color: #ffffff; }
.text-slate-300  { color: #d1d9e6; }
.text-slate-400  { color: #a8b5c8; }
.text-slate-500  { color: #7a8ba0; }

/* Colors — Text (Accents) */
.text-cyan-300    { color: #67e8f9; }
.text-cyan-400    { color: #22d3ee; }
.text-emerald-400 { color: #34d399; }
.text-amber-300   { color: #fcd34d; }
.text-amber-400   { color: #fbbf24; }
.text-red-400     { color: #f87171; }
.text-blue-400    { color: #60a5fa; }
.text-purple-400  { color: #c084fc; }
.text-orange-400  { color: #fb923c; }

/* ---------------------------------------------------------------------------
 * Colors — Backgrounds (Slate palette)
 * --------------------------------------------------------------------------- */
.bg-slate-900     { background-color: #0f172a; }
.bg-slate-800     { background-color: #1e293b; }
.bg-slate-800\/50 { background-color: rgba(30, 41, 59, 0.5); }
.bg-slate-700     { background-color: #334155; }
.bg-slate-700\/50 { background-color: rgba(51, 65, 85, 0.5); }
.bg-slate-600     { background-color: #475569; }
.bg-slate-500\/20 { background-color: rgba(100, 116, 139, 0.2); }

/* Colors — Backgrounds (Accents) */
.bg-cyan-500       { background-color: #06b6d4; }
.bg-cyan-500\/20   { background-color: rgba(6, 182, 212, 0.2); }
.bg-emerald-500    { background-color: #10b981; }
.bg-emerald-500\/20 { background-color: rgba(16, 185, 129, 0.2); }
.bg-amber-500      { background-color: #f59e0b; }
.bg-amber-500\/5   { background-color: rgba(245, 158, 11, 0.05); }
.bg-amber-500\/10  { background-color: rgba(245, 158, 11, 0.1); }
.bg-amber-500\/20  { background-color: rgba(245, 158, 11, 0.2); }
.bg-red-500        { background-color: #ef4444; }
.bg-red-500\/20    { background-color: rgba(239, 68, 68, 0.2); }
.bg-blue-500\/20   { background-color: rgba(59, 130, 246, 0.2); }
.bg-purple-500\/20 { background-color: rgba(168, 85, 247, 0.2); }
.bg-orange-500\/20 { background-color: rgba(249, 115, 22, 0.2); }

/* ---------------------------------------------------------------------------
 * Borders
 * --------------------------------------------------------------------------- */
.border          { border-width: 1px; border-style: solid; }
.border-2        { border-width: 2px; border-style: solid; }
.border-t        { border-top-width: 1px; border-top-style: solid; }
.border-b        { border-bottom-width: 1px; border-bottom-style: solid; }
.border-dashed   { border-style: dashed; }

.border-slate-500 { border-color: #64748b; }
.border-slate-600 { border-color: #475569; }
.border-slate-700 { border-color: #334155; }
.border-amber-500 { border-color: #f59e0b; }

.rounded      { border-radius: 0.25rem; }
.rounded-lg   { border-radius: 0.5rem; }
.rounded-xl   { border-radius: 0.75rem; }
.rounded-2xl  { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* ---------------------------------------------------------------------------
 * Effects
 * --------------------------------------------------------------------------- */
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.opacity-50 { opacity: 0.5; }
.opacity-90 { opacity: 0.9; }

/* ---------------------------------------------------------------------------
 * Overflow
 * --------------------------------------------------------------------------- */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* ---------------------------------------------------------------------------
 * Interactivity
 * --------------------------------------------------------------------------- */
.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

/* ---------------------------------------------------------------------------
 * Transitions
 * --------------------------------------------------------------------------- */
.transition         { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-duration: 150ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.transition-all     { transition-property: all; transition-duration: 150ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.transition-colors  { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-duration: 150ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.transition-transform { transition-property: transform; transition-duration: 150ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* ---------------------------------------------------------------------------
 * Hover States
 * --------------------------------------------------------------------------- */
.hover\:bg-slate-600:hover       { background-color: #475569; }
.hover\:bg-slate-700\/50:hover   { background-color: rgba(51, 65, 85, 0.5); }
.hover\:bg-cyan-600:hover        { background-color: #0891b2; }
.hover\:bg-amber-600:hover       { background-color: #d97706; }
.hover\:bg-amber-500\/20:hover   { background-color: rgba(245, 158, 11, 0.2); }
.hover\:bg-emerald-500\/20:hover { background-color: rgba(16, 185, 129, 0.2); }
.hover\:bg-red-500\/20:hover     { background-color: rgba(239, 68, 68, 0.2); }

.hover\:text-white:hover      { color: #ffffff; }
.hover\:text-cyan-300:hover   { color: #67e8f9; }
.hover\:text-cyan-400:hover   { color: #22d3ee; }
.hover\:text-red-300:hover    { color: #fca5a5; }
.hover\:text-red-400:hover    { color: #f87171; }

.hover\:border-cyan-500:hover { border-color: #06b6d4; }
.hover\:ring-2:hover          { box-shadow: 0 0 0 2px var(--tw-ring-color, rgba(6, 182, 212, 0.5)); }
.hover\:ring-cyan-500\/50:hover { --tw-ring-color: rgba(6, 182, 212, 0.5); }

/* ---------------------------------------------------------------------------
 * Focus States
 * --------------------------------------------------------------------------- */
.focus\:outline-none:focus     { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:border-cyan-500:focus  { border-color: #06b6d4; }

/* ---------------------------------------------------------------------------
 * Accessibility
 * --------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Missing color classes (gap fix) ─────────────────────────────────────── */
.bg-amber-600 { background-color: #d97706; }
.bg-cyan-600 { background-color: #0891b2; }
.bg-emerald-600 { background-color: #059669; }

.border-cyan-500 { border-color: #06b6d4; }
.border-emerald-500 { border-color: #10b981; }
.border-purple-500 { border-color: #a855f7; }
.border-red-500 { border-color: #ef4444; }

.text-red-300 { color: #fca5a5; }
.text-black { color: #000000; }

/* ── Missing hover variants ──────────────────────────────────────────────── */
.hover\:bg-amber-500:hover { background-color: #f59e0b; }
.hover\:bg-emerald-500:hover { background-color: #10b981; }
.hover\:bg-emerald-600:hover { background-color: #059669; }
.hover\:bg-red-500:hover { background-color: #ef4444; }
.hover\:bg-slate-700:hover { background-color: #334155; }

.hover\:ring-cyan-500:hover { --tw-ring-color: #06b6d4; }

/* ── Missing focus variant ───────────────────────────────────────────────── */
.focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.focus\:ring-cyan-500:focus { --tw-ring-color: #06b6d4; }

/* ── Global readability & card contrast enhancements ─────────────────────── */
/* Add subtle borders to bg-slate-800 cards for better separation */
.bg-slate-800.rounded-xl,
.bg-slate-800.rounded-2xl,
.bg-slate-800.rounded-lg {
    border: 1px solid rgba(62, 189, 196, 0.08);
}

/* Boost table text readability */
table td, table th {
    color: #d1d9e6;
}

/* Make monospace/code text brighter */
.code-font, code, pre, [style*="monospace"] {
    color: #e2e8f0;
}

/* Ensure stat values are bright and legible */
.text-2xl.font-bold,
.text-4xl.font-bold,
.text-xl.font-bold {
    color: #f1f5f9;
}

/* Responsive grid fix */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
