/* ========================================================
   Mini-Tailwind CSS - Advanced Version
   ======================================================== */

/* ==== 1. Variables (Color Palette) ==== */
:root {
  /* Grays */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-750: #1c2433;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Colors */
  --blue-300: #93c5fd; --blue-400: #60a5fa; --blue-500: #3b82f6; --blue-600: #2563eb;
  --red-400: #f87171; --red-500: #ef4444; --red-600: #dc2626; --red-700: #b91c1c;
  --green-400: #4ade80; --green-500: #22c55e; --green-600: #16a34a; --green-700: #15803d;
  --yellow-400: #facc15; --yellow-500: #eab308;
  --amber-400: #fbbf24;
  --purple-500: #a855f7; --purple-600: #9333ea; --purple-700: #7e22ce;
}

/* ==== 2. Base & Reset ==== */
*, *::before, *::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: var(--gray-200);
}

html, body {
  margin: 0;
  padding: 0;
  line-height: 1.5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==== 3. Display ==== */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* ==== 4. Flexbox & Grid Layouts ==== */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }

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

.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)); }

/* Gaps */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* ==== 5. Spacing (Margin & Padding) ==== */
/* 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; } .p-10 { padding: 2.5rem; }
.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; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; } .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; }
.pl-2 { padding-left: 0.5rem; } .pl-4 { padding-left: 1rem; } .pl-10 { padding-left: 2.5rem; }
.pt-2 { padding-top: 0.5rem; } .pt-4 { padding-top: 1rem; }
.pb-2 { padding-bottom: 0.5rem; } .pb-4 { padding-bottom: 1rem; }

/* Margin */
.m-0 { margin: 0; } .m-1 { margin: 0.25rem; } .m-2 { margin: 0.5rem; } .m-4 { margin: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }
.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; } .mt-8 { margin-top: 2rem; }
.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; }
.ml-2 { margin-left: 0.5rem; } .ml-4 { margin-left: 1rem; } .ml-auto { margin-left: auto; }
.mr-2 { margin-right: 0.5rem; } .mr-4 { margin-right: 1rem; } .mr-auto { margin-right: auto; }

/* Space Between */
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.space-x-4 > :not([hidden]) ~ :not([hidden]) { margin-left: 1rem; }

/* ==== 6. Sizing (Width & Height) ==== */
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.w-2\/3 { width: 66.666667%; }
.w-1\/4 { width: 25%; }
.w-auto { width: auto; }
.w-4 { width: 1rem; } .w-5 { width: 1.25rem; } .w-6 { width: 1.5rem; } .w-8 { width: 2rem; } .w-10 { width: 2.5rem; } .w-12 { width: 3rem; }

.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.h-4 { height: 1rem; } .h-5 { height: 1.25rem; } .h-6 { height: 1.5rem; } .h-8 { height: 2rem; } .h-10 { height: 2.5rem; } .h-12 { height: 3rem; }

.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-7xl { max-width: 80rem; }

/* ==== 7. Typography ==== */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.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-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }

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

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.leading-relaxed { line-height: 1.625; }
.break-words { overflow-wrap: break-word; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==== 8. Colors (Text & Backgrounds) ==== */
.text-transparent { color: transparent; }
.text-white { color: #fff; }
.text-black { color: #000; }
.text-gray-100 { color: var(--gray-100); }
.text-gray-200 { color: var(--gray-200); }
.text-gray-300 { color: var(--gray-300); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-800 { color: var(--gray-800); }
.text-gray-900 { color: var(--gray-900); }

.text-blue-300 { color: var(--blue-300); } .text-blue-400 { color: var(--blue-400); } .text-blue-500 { color: var(--blue-500); }
.text-red-500 { color: var(--red-500); }
.text-green-500 { color: var(--green-500); }
.text-yellow-500 { color: var(--yellow-500); }
.text-amber-400 { color: var(--amber-400); }

.bg-white { background-color: #fff; }
.bg-black { background-color: #000; }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-gray-700 { background-color: var(--gray-700); }
.bg-gray-750 { background-color: var(--gray-750); }
.bg-gray-800 { background-color: var(--gray-800); }
.bg-gray-900 { background-color: var(--gray-900); }

.bg-blue-500 { background-color: var(--blue-500); } .bg-blue-600 { background-color: var(--blue-600); }
.bg-green-500 { background-color: var(--green-500); } .bg-green-600 { background-color: var(--green-600); } .bg-green-700 { background-color: var(--green-700); }
.bg-red-500 { background-color: var(--red-500); } .bg-red-600 { background-color: var(--red-600); } .bg-red-700 { background-color: var(--red-700); }
.bg-purple-600 { background-color: var(--purple-600); } .bg-purple-700 { background-color: var(--purple-700); }

/* Gradients */
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-from, transparent), var(--tw-gradient-to, transparent)); }
.bg-clip-text { -webkit-background-clip: text; background-clip: text; }

.from-blue-400 { --tw-gradient-from: var(--blue-400); } .to-purple-500 { --tw-gradient-to: var(--purple-500); }
.from-green-500 { --tw-gradient-from: var(--green-500); } .to-blue-500 { --tw-gradient-to: var(--blue-500); }

/* ==== 9. Borders & Shadows ==== */
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }

.border-transparent { border-color: transparent; }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }
.border-gray-600 { border-color: var(--gray-600); }
.border-gray-700 { border-color: var(--gray-700); }
.border-gray-600\/50 { border-color: rgba(75, 85, 99, 0.5); }

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06); }

/* ==== 10. Position & Z-index ==== */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; } .bottom-0 { bottom: 0; } .left-0 { left: 0; } .right-0 { right: 0; }
.top-8 { top: 2rem; } .bottom-12 { bottom: 3rem; } .bottom-14 { bottom: 3.5rem; }

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

/* ==== 11. Interactivity & Effects ==== */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

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

/* States: Hover, Focus, Disabled */
.hover\:underline:hover { text-decoration: underline; }
.hover\:text-gray-300:hover { color: var(--gray-300); }
.hover\:text-white:hover { color: #fff; }

.hover\:bg-gray-100:hover { background-color: var(--gray-100); }
.hover\:bg-gray-500:hover { background-color: var(--gray-500); }
.hover\:bg-gray-600:hover { background-color: var(--gray-600); }
.hover\:bg-blue-600:hover { background-color: var(--blue-600); }
.hover\:bg-green-600:hover { background-color: var(--green-600); }
.hover\:bg-green-700:hover { background-color: var(--green-700); }
.hover\:bg-red-600:hover { background-color: var(--red-600); }
.hover\:bg-red-700:hover { background-color: var(--red-700); }
.hover\:bg-purple-700:hover { background-color: var(--purple-700); }

.hover\:from-green-600:hover { --tw-gradient-from: var(--green-600); }
.hover\:to-blue-600:hover { --tw-gradient-to: var(--blue-600); }

.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); }
.focus\:ring-blue-500:focus { outline: 2px solid var(--blue-500); }
.focus\:ring-red-500:focus { outline: 2px solid var(--red-500); }

.disabled\:opacity-50:disabled { opacity: 0.5; }
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }

/* ==== 12. Custom Classes ==== */
.help-tooltip {
  position: absolute;
  background: var(--gray-900);
  color: var(--gray-200);
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-700);
  font-size: 0.75rem;
  max-width: 18rem;
  z-index: 50;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.status-message {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* ==== 13. Responsive Breakpoints ==== */

/* Small devices (tablets, 640px and up) */
@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:w-auto { width: auto; }
  .sm\:p-4 { padding: 1rem; }
}

/* Medium devices (desktops, 768px and up) */
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .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\:p-8 { padding: 2rem; }
  .md\:px-10 { padding-left: 2.5rem; padding-right: 2.5rem; }
  .md\:w-auto { width: auto; }
  .md\:w-1\/2 { width: 50%; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:left-0 { left: 0; }
  .md\:right-auto { right: auto; }
}

/* Large devices (large desktops, 1024px and up) */
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:w-1\/3 { width: 33.333333%; }
  .lg\:p-10 { padding: 2.5rem; }
}
