/*
 * CloudUI responsive utilities polyfill
 *
 * CloudUI ships with a prebuilt Tailwind CSS (cloudui.css) whose JIT scanner
 * only includes literal class names from pre-existing templates. Many
 * responsive variants (sm:*, md:*, lg:*) used in custom page templates are
 * missing from that build and would silently fail.
 *
 * This file polyfills the missing utility classes so that custom templates
 * can use standard Tailwind breakpoint syntax without needing a rebuild.
 *
 * Breakpoints follow Tailwind defaults: sm=640px, md=768px, lg=1024px.
 */

/* ---------- Base (all widths) ---------- */
.flex-nowrap { flex-wrap: nowrap; }
.w-11 { width: 2.75rem; }
.h-11 { height: 2.75rem; }
.-mx-1 { margin-left: -0.25rem; margin-right: -0.25rem; }

/* ---------- sm: (>=640px) ---------- */
@media (min-width: 640px) {
    .sm\:flex-wrap { flex-wrap: wrap; }
    .sm\:items-start { align-items: flex-start; }
    .sm\:justify-between { justify-content: space-between; }
    .sm\:gap-1 { gap: 0.25rem; }
    .sm\:gap-3 { gap: 0.75rem; }
    .sm\:gap-4 { gap: 1rem; }
    .sm\:px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
    .sm\:py-4 { padding-top: 1rem; padding-bottom: 1rem; }
    .sm\:py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .sm\:w-auto { width: auto; }
    .sm\:w-6 { width: 1.5rem; }
    .sm\:h-6 { height: 1.5rem; }
    .sm\:w-12 { width: 3rem; }
    .sm\:h-12 { height: 3rem; }
    .sm\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
    .sm\:table-header-group { display: table-header-group; }
}

/* ---------- md: (>=768px) ---------- */
@media (min-width: 768px) {
    .md\:table-cell { display: table-cell; }
}

/* ---------- lg: (>=1024px) ---------- */
@media (min-width: 1024px) {
    .lg\:table-cell { display: table-cell; }
    .lg\:flex-shrink-0 { flex-shrink: 0; }
    .lg\:mx-0 { margin-left: 0; margin-right: 0; }
}

/* ====================================================================
 * CloudUI P0 template port polyfill — utilities used by new templates
 * (affiliatessignup, account-*, clientareadomain*, two-factor-*, etc.)
 * ==================================================================== */

/* Layout / sizing */
.basis-full { flex-basis: 100%; }
.shrink-0 { flex-shrink: 0; }
.w-24 { width: 6rem; }
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.h-3\.5 { height: 0.875rem; }
.w-3\.5 { width: 0.875rem; }
.h-4\.5 { height: 1.125rem; }
.w-4\.5 { width: 1.125rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }

/* Borders */
.border-l { border-left-width: 1px; }
.border-r { border-right-width: 1px; }
.border-l-0 { border-left-width: 0; }
.border-r-0 { border-right-width: 0; }
.border-b-0 { border-bottom-width: 0; }
.border-t-2 { border-top-width: 2px; }
.border-transparent { border-color: transparent; }
.border-red-200 { border-color: rgb(254 202 202); }
.border-red-700 { border-color: rgb(185 28 28); }
.border-amber-200 { border-color: rgb(253 230 138); }
.border-emerald-200 { border-color: rgb(167 243 208); }
.border-emerald-600 { border-color: rgb(5 150 105); }
.border-blue-200 { border-color: rgb(191 219 254); }

/* Backgrounds */
.bg-amber-50 { background-color: rgb(255 251 235); }
.bg-blue-50 { background-color: rgb(239 246 255); }
.bg-red-50 { background-color: rgb(254 242 242); }
.bg-emerald-50 { background-color: rgb(236 253 245); }
.bg-emerald-600 { background-color: rgb(5 150 105); }
.bg-red-600 { background-color: rgb(220 38 38); }
.bg-slate-50 { background-color: rgb(248 250 252); }
.bg-slate-100 { background-color: rgb(241 245 249); }
.bg-slate-200 { background-color: rgb(226 232 240); }
.bg-black\/50 { background-color: rgba(0,0,0,0.5); }
.hover\:bg-emerald-700:hover { background-color: rgb(4 120 87); }
.hover\:bg-red-700:hover { background-color: rgb(185 28 28); }
.hover\:bg-red-50:hover { background-color: rgb(254 242 242); }
.hover\:bg-slate-50:hover { background-color: rgb(248 250 252); }
.hover\:bg-slate-100:hover { background-color: rgb(241 245 249); }

/* Text colors */
.text-emerald-700 { color: rgb(4 120 87); }
.text-emerald-500 { color: rgb(16 185 129); }
.text-red-700 { color: rgb(185 28 28); }
.text-red-500 { color: rgb(239 68 68); }
.text-red-600 { color: rgb(220 38 38); }
.text-amber-700 { color: rgb(180 83 9); }
.text-amber-500 { color: rgb(245 158 11); }
.text-blue-700 { color: rgb(29 78 216); }
.text-blue-500 { color: rgb(59 130 246); }

/* Padding (corner / fractional values) */
.p-3 { padding: 0.75rem; }
.p-6 { padding: 1.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.pl-6 { padding-left: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }

/* Spacing (axis) */
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.divide-y > * + * { border-top-width: 1px; }
.divide-slate-100 > * + * { border-color: rgb(241 245 249); }

/* Items / justify */
.items-end { align-items: flex-end; }

/* Rounding (sides) */
.rounded-r-md { border-top-right-radius: 0.375rem; border-bottom-right-radius: 0.375rem; }
.rounded-r-none { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.rounded-l-none { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.rounded-t-md { border-top-left-radius: 0.375rem; border-top-right-radius: 0.375rem; }
.rounded-b-md { border-bottom-left-radius: 0.375rem; border-bottom-right-radius: 0.375rem; }

/* State */
.cursor-not-allowed { cursor: not-allowed; }
.pointer-events-none { pointer-events: none; }
.opacity-50 { opacity: 0.5; }

/* Forms / ring */
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--tw-ring-offset-color,#fff), 0 0 0 4px rgba(37,99,235,.35); }
.focus\:ring-brand-500:focus { --tw-ring-color: #3b82f6; }

/* Position / animation */
.absolute { position: absolute; }
.fixed { position: fixed; }
.relative { position: relative; }
.inset-0 { top:0; right:0; bottom:0; left:0; }
.top-3 { top: 0.75rem; }
.right-3 { right: 0.75rem; }
.z-50 { z-index: 50; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* Display utilities & responsive helpers */
.print\:hidden { }
@media print { .print\:hidden { display: none !important; } }

/* Min height */
.min-h-screen { min-height: 100vh; }

/* ---------- md: extra coverage ---------- */
@media (min-width: 768px) {
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:col-span-3 { grid-column: span 3 / span 3; }
    .md\:col-span-4 { grid-column: span 4 / span 4; }
    .md\:col-span-6 { grid-column: span 6 / span 6; }
    .md\:col-span-7 { grid-column: span 7 / span 7; }
    .md\:col-span-8 { grid-column: span 8 / span 8; }
    .md\:col-start-5 { grid-column-start: 5; }
    .md\:text-right { text-align: right; }
    .md\:text-left { text-align: left; }
    .md\:flex { display: flex; }
    .md\:flex-row { flex-direction: row; }
    .md\:items-center { align-items: center; }
    .md\:items-start { align-items: flex-start; }
    .md\:justify-between { justify-content: space-between; }
    .md\:pt-2 { padding-top: 0.5rem; }
    .md\:p-8 { padding: 2rem; }
}

/* ---------- lg: extra coverage ---------- */
@media (min-width: 1024px) {
    .lg\:col-span-3 { grid-column: span 3 / span 3; }
    .lg\:col-span-4 { grid-column: span 4 / span 4; }
    .lg\:col-span-6 { grid-column: span 6 / span 6; }
    .lg\:col-span-8 { grid-column: span 8 / span 8; }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}
