@tailwind base;
@tailwind components;
@tailwind utilities;

/* BoostBot Admin Styles */

/* Fix for WordPress Admin CSS conflicts */
.boostbot-admin.flex.min-h-screen.bg-gray-50 {
  display: flex !important;
  align-items: stretch; /* Ensure children have equal height */
}

.boostbot-admin .flex-1 {
  /* Match aside sibling height via flex stretch */
  align-self: stretch;
  max-height: 100%;
  overflow-y: auto;
}

.boostbot-admin {
  /* CSS Variables from Design System */
  --color-primary: #3BC2D0;
  --color-primary-dark: #2F9BA6;
  --color-primary-light: #A3E7EC;
  --color-accent: #E32774;
  --color-accent-dark: #B61F5D;
  --color-accent-light: #F5A3C3;
  
  /* Typography */
  --font-sans: 'Heebo', system-ui, sans-serif;
  --font-display: 'TelAviv-Brutalist', 'Heebo', sans-serif;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  
  /* Reset WordPress Admin styles */
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  
  /* Full height */
  min-height: 100vh;
}

/* ========================================
   DIRECTION SYSTEM - LTR/RTL
   ======================================== */

/* Default: LTR */
.boostbot-admin,
.boostbot-admin.boostbot-ltr {
  direction: ltr;
  text-align: start;
}

/* RTL Override */
.boostbot-admin.boostbot-rtl,
.boostbot-admin[dir="rtl"] {
  direction: rtl;
  text-align: start;
}

/* ========================================
   FONT SYSTEM - Direction-aware
   ======================================== */

/* LTR Fonts (English/System) */
.boostbot-admin.boostbot-ltr,
.boostbot-admin[dir="ltr"] {
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Inter', var(--font-sans);
}

/* RTL Fonts (Hebrew) */
.boostbot-admin.boostbot-rtl,
.boostbot-admin[dir="rtl"] {
  --font-sans: 'Heebo', system-ui, sans-serif;
  --font-display: 'TelAviv-Brutalist', 'Heebo', sans-serif;
}

/* ========================================
   DIRECTION-AWARE UTILITIES
   ======================================== */

/* Logical Properties (work for both directions automatically) */
.boostbot-admin .ps-1 { padding-inline-start: 0.25rem; }
.boostbot-admin .pe-1 { padding-inline-end: 0.25rem; }
.boostbot-admin .ps-2 { padding-inline-start: 0.5rem; }
.boostbot-admin .pe-2 { padding-inline-end: 0.5rem; }
.boostbot-admin .ps-3 { padding-inline-start: 0.75rem; }
.boostbot-admin .pe-3 { padding-inline-end: 0.75rem; }
.boostbot-admin .ps-4 { padding-inline-start: 1rem; }
.boostbot-admin .pe-4 { padding-inline-end: 1rem; }
.boostbot-admin .ps-6 { padding-inline-start: 1.5rem; }
.boostbot-admin .pe-6 { padding-inline-end: 1.5rem; }

.boostbot-admin .ms-1 { margin-inline-start: 0.25rem; }
.boostbot-admin .me-1 { margin-inline-end: 0.25rem; }
.boostbot-admin .ms-2 { margin-inline-start: 0.5rem; }
.boostbot-admin .me-2 { margin-inline-end: 0.5rem; }
.boostbot-admin .ms-3 { margin-inline-start: 0.75rem; }
.boostbot-admin .me-3 { margin-inline-end: 0.75rem; }
.boostbot-admin .ms-4 { margin-inline-start: 1rem; }
.boostbot-admin .me-4 { margin-inline-end: 1rem; }

.boostbot-admin .start-0 { inset-inline-start: 0; }
.boostbot-admin .end-0 { inset-inline-end: 0; }
.boostbot-admin .start-auto { inset-inline-start: auto; }
.boostbot-admin .end-auto { inset-inline-end: auto; }

.boostbot-admin .text-start { text-align: start; }
.boostbot-admin .text-end { text-align: end; }

.boostbot-admin .border-s { border-inline-start-width: 1px; }
.boostbot-admin .border-e { border-inline-end-width: 1px; }
.boostbot-admin .border-s-2 { border-inline-start-width: 2px; }
.boostbot-admin .border-e-2 { border-inline-end-width: 2px; }

.boostbot-admin .rounded-s { 
  border-start-start-radius: 0.25rem; 
  border-end-start-radius: 0.25rem; 
}
.boostbot-admin .rounded-e { 
  border-start-end-radius: 0.25rem; 
  border-end-end-radius: 0.25rem; 
}

/* ========================================
   COMPONENT OVERRIDES FOR RTL
   ======================================== */

/* Sidebar - border on content-facing side */
.boostbot-admin .sidebar {
  border-inline-end: 1px solid var(--color-border, #e5e7eb);
  border-inline-start: none;
}

/* Icons that need flipping in RTL (arrows, etc.) */
.boostbot-admin.boostbot-rtl .icon-flip-rtl {
  transform: scaleX(-1);
}

/* Transitions - flip slide direction */
.boostbot-admin.boostbot-rtl .slide-in-left {
  animation-name: slideInRight;
}

.boostbot-admin.boostbot-ltr .slide-in-right {
  animation-name: slideInLeft;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Custom scrollbar */
.boostbot-admin ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.boostbot-admin ::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.boostbot-admin ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.boostbot-admin ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus states for accessibility */
.boostbot-admin *:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Transitions */
.boostbot-admin * {
  transition-property: color, background-color, border-color, box-shadow, opacity, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Animation keyframes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.3s ease-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Range Slider Styles */
.boostbot-admin input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: #e5e7eb;
  cursor: pointer;
}

.boostbot-admin input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary, #3BC2D0);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.boostbot-admin input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.boostbot-admin input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(0.95);
}

.boostbot-admin input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary, #3BC2D0);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.boostbot-admin input[type="range"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.boostbot-admin input[type="range"]:disabled::-webkit-slider-thumb {
  background: #9ca3af;
}

/* Dropdown/Popup visibility fixes */
/* Ensure dropdown menus and popups are visible above WordPress admin */
.boostbot-admin [style*="position: absolute"],
.boostbot-admin [style*="position:absolute"] {
  /* Allow dropdowns to overflow parent containers */
}

/* Ensure accordions and sections don't clip content */
.boostbot-admin .accordion-content,
.boostbot-admin [class*="Section"],
.boostbot-admin [class*="section"] {
  overflow: visible !important;
}

/* Fix for nested overflow contexts */
.boostbot-admin .relative {
  overflow: visible;
}

/* Utility classes */
@layer utilities {
  .text-balance {
    text-wrap: balance;
  }
  
  /* RTL-aware margin/padding */
  .ms-auto {
    margin-inline-start: auto;
  }
  
  .me-auto {
    margin-inline-end: auto;
  }
}




