/* ==========================================================================
   HostBillingPro Design System
   Foundation tokens, typography, base styles, animations & utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* ── Color Palette ─────────────────────────────────────────────────────── */
  --hbp-primary:    #0F172A;
  --hbp-secondary:  #2563EB;
  --hbp-accent:     #10B981;
  --hbp-bg:         #FFFFFF;
  --hbp-text:       #111827;
  --hbp-text-light: #6B7280;
  --hbp-border:     #E5E7EB;
  --hbp-bg-alt:     #F8FAFC;
  --hbp-bg-dark:    #1E293B;
  --hbp-warning:    #F59E0B;
  --hbp-danger:     #EF4444;
  --hbp-purple:     #8B5CF6;

  /* Derived / translucent variants */
  --hbp-secondary-hover: #1D4ED8;
  --hbp-accent-hover:    #059669;
  --hbp-secondary-10:    rgba(37, 99, 235, 0.10);
  --hbp-accent-10:       rgba(16, 185, 129, 0.10);
  --hbp-primary-90:      rgba(15, 23, 42, 0.90);
  --hbp-overlay:         rgba(15, 23, 42, 0.60);

  /* ── Spacing (8px base unit) ───────────────────────────────────────────── */
  --hbp-space-1:   8px;
  --hbp-space-2:  16px;
  --hbp-space-3:  24px;
  --hbp-space-4:  32px;
  --hbp-space-5:  40px;
  --hbp-space-6:  48px;
  --hbp-space-7:  56px;
  --hbp-space-8:  64px;
  --hbp-space-9:  72px;
  --hbp-space-10: 80px;
  --hbp-space-12: 96px;
  --hbp-space-14: 112px;
  --hbp-space-16: 128px;

  /* ── Shadows ───────────────────────────────────────────────────────────── */
  --hbp-shadow-sm:  0  1px  2px rgba(0, 0, 0, 0.05);
  --hbp-shadow-md:  0  4px  6px -1px rgba(0, 0, 0, 0.07),
                    0  2px  4px -2px rgba(0, 0, 0, 0.05);
  --hbp-shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.08),
                    0  4px  6px -4px rgba(0, 0, 0, 0.04);
  --hbp-shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.10),
                    0  8px 10px -6px rgba(0, 0, 0, 0.04);

  /* ── Border Radius ─────────────────────────────────────────────────────── */
  --hbp-radius-sm:   4px;
  --hbp-radius-md:   6px;
  --hbp-radius-base: 8px;
  --hbp-radius-lg:  12px;
  --hbp-radius-xl:  16px;
  --hbp-radius-2xl: 24px;
  --hbp-radius-full: 9999px;

  /* ── Transitions ───────────────────────────────────────────────────────── */
  --hbp-transition-fast:   0.15s ease;
  --hbp-transition-base:   0.3s ease;
  --hbp-transition-slow:   0.5s ease;
  --hbp-transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Typography ────────────────────────────────────────────────────────── */
  --hbp-font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --hbp-font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --hbp-font-mono:    'Fira Code', 'Consolas', monospace;

  --hbp-line-height:      1.7;
  --hbp-line-height-tight: 1.3;

  /* ── Layout ────────────────────────────────────────────────────────────── */
  --hbp-container-max: 1200px;
  --hbp-content-max:   760px;
}

/* --------------------------------------------------------------------------
   2. Global Typography Overrides (GeneratePress)
   -------------------------------------------------------------------------- */

/* Base body */
body,
.site {
  font-family: var(--hbp-font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: var(--hbp-line-height);
  color: var(--hbp-text);
  background-color: var(--hbp-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings — Poppins 600-700 */
h1, h2, h3, h4, h5, h6,
.entry-title,
.page-title,
.site-title {
  font-family: var(--hbp-font-heading);
  font-weight: 700;
  line-height: var(--hbp-line-height-tight);
  color: var(--hbp-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem);   margin-bottom: var(--hbp-space-3); }
h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); margin-bottom: var(--hbp-space-2); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); margin-bottom: var(--hbp-space-2); }
h4 { font-size: 1.25rem; font-weight: 600;    margin-bottom: var(--hbp-space-1); }
h5 { font-size: 1.125rem; font-weight: 600;   margin-bottom: var(--hbp-space-1); }
h6 { font-size: 1rem; font-weight: 600;       margin-bottom: var(--hbp-space-1); }

/* --------------------------------------------------------------------------
   3. Base Element Styles
   -------------------------------------------------------------------------- */

/* Links */
a {
  color: var(--hbp-secondary);
  text-decoration: none;
  transition: color var(--hbp-transition-fast);
}

a:hover,
a:focus-visible {
  color: var(--hbp-secondary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Paragraphs */
p {
  margin-bottom: var(--hbp-space-2);
  color: var(--hbp-text);
}

/* Lists */
ul, ol {
  margin-bottom: var(--hbp-space-2);
  padding-left: var(--hbp-space-3);
}

li {
  margin-bottom: var(--hbp-space-1);
  line-height: var(--hbp-line-height);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Blockquotes */
blockquote {
  margin: var(--hbp-space-4) 0;
  padding: var(--hbp-space-3) var(--hbp-space-4);
  border-left: 4px solid var(--hbp-secondary);
  background-color: var(--hbp-bg-alt);
  border-radius: 0 var(--hbp-radius-base) var(--hbp-radius-base) 0;
  font-style: italic;
  color: var(--hbp-text);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Code */
code {
  font-family: var(--hbp-font-mono);
  font-size: 0.875em;
  padding: 2px 6px;
  background-color: var(--hbp-bg-alt);
  border: 1px solid var(--hbp-border);
  border-radius: var(--hbp-radius-sm);
  color: var(--hbp-danger);
}

pre {
  margin: var(--hbp-space-3) 0;
  padding: var(--hbp-space-3);
  background-color: var(--hbp-primary);
  border-radius: var(--hbp-radius-lg);
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #E2E8F0;
  font-size: 0.875rem;
}

/* Horizontal Rule */
hr {
  border: 0;
  height: 1px;
  background: var(--hbp-border);
  margin: var(--hbp-space-6) 0;
}

/* Tables (base) */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--hbp-space-4);
}

th, td {
  padding: var(--hbp-space-1) var(--hbp-space-2);
  text-align: left;
  border-bottom: 1px solid var(--hbp-border);
}

th {
  font-family: var(--hbp-font-heading);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hbp-text-light);
}

/* Selection */
::selection {
  background-color: var(--hbp-secondary);
  color: #fff;
}

/* Focus outline */
:focus-visible {
  outline: 2px solid var(--hbp-secondary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Animation Keyframes
   -------------------------------------------------------------------------- */

@keyframes hbp-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes hbp-scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes hbp-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes hbp-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Animation utility classes */
.hbp-animate-fadeInUp {
  animation: hbp-fadeInUp 0.6s ease forwards;
}

.hbp-animate-slideInLeft {
  animation: hbp-slideInLeft 0.6s ease forwards;
}

.hbp-animate-slideInRight {
  animation: hbp-slideInRight 0.6s ease forwards;
}

.hbp-animate-scaleIn {
  animation: hbp-scaleIn 0.5s ease forwards;
}

.hbp-animate-float {
  animation: hbp-float 3s ease-in-out infinite;
}

/* Staggered animation delays */
.hbp-delay-1 { animation-delay: 0.1s; }
.hbp-delay-2 { animation-delay: 0.2s; }
.hbp-delay-3 { animation-delay: 0.3s; }
.hbp-delay-4 { animation-delay: 0.4s; }
.hbp-delay-5 { animation-delay: 0.5s; }

/* --------------------------------------------------------------------------
   5. Utility Classes
   -------------------------------------------------------------------------- */

/* Container */
.hbp-container {
  width: 100%;
  max-width: var(--hbp-container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--hbp-space-2);
  padding-right: var(--hbp-space-2);
}

/* Section wrapper */
.hbp-section {
  padding: var(--hbp-space-8) 0;
}

.hbp-section--alt {
  background-color: var(--hbp-bg-alt);
}

.hbp-section--dark {
  background-color: var(--hbp-bg-dark);
  color: #fff;
}

/* CSS Grid utility */
.hbp-grid {
  display: grid;
  gap: var(--hbp-space-3);
}

.hbp-grid--2 {
  grid-template-columns: repeat(1, 1fr);
}

.hbp-grid--3 {
  grid-template-columns: repeat(1, 1fr);
}

.hbp-grid--4 {
  grid-template-columns: repeat(1, 1fr);
}

/* Screen reader only */
.hbp-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;
}

/* Text utilities */
.hbp-text-center { text-align: center; }
.hbp-text-left   { text-align: left; }
.hbp-text-right  { text-align: right; }

.hbp-text-primary { color: var(--hbp-primary); }
.hbp-text-secondary { color: var(--hbp-secondary); }
.hbp-text-accent { color: var(--hbp-accent); }
.hbp-text-muted { color: var(--hbp-text-light); }
.hbp-text-white { color: #fff; }

/* Flex utilities */
.hbp-flex { display: flex; }
.hbp-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.hbp-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Spacing helpers */
.hbp-mt-0  { margin-top: 0; }
.hbp-mt-2  { margin-top: var(--hbp-space-2); }
.hbp-mt-4  { margin-top: var(--hbp-space-4); }
.hbp-mt-6  { margin-top: var(--hbp-space-6); }
.hbp-mb-0  { margin-bottom: 0; }
.hbp-mb-2  { margin-bottom: var(--hbp-space-2); }
.hbp-mb-4  { margin-bottom: var(--hbp-space-4); }
.hbp-mb-6  { margin-bottom: var(--hbp-space-6); }
