/* ============================================================
   GROOP Custom CSS
   Based on groop_style_guide.md
   For styles that don't fit neatly in Tailwind
   ============================================================ */

/* ============================================================
   CSS Custom Properties (Design Tokens)
   Based on South African flag colors, adapted for digital
   ============================================================ */

:root {
  /* Light mode (default) */

  /* Backgrounds */
  --color-bg-page: #FFFFFF;
  --color-bg-surface: #FAFAF9;
  --color-bg-elevated: #FFFFFF;
  --color-bg-muted: #F5F5F4;

  /* Borders */
  --color-border: #D6D3D1;
  --color-border-subtle: #E7E5E4;

  /* Text */
  --color-text-primary: #000000;
  --color-text-secondary: #333333;
  --color-text-muted: #666666;

  /* ============================================================
     EXACT South African Flag Colors
     ============================================================ */

  /* Site Primary - SA Flag Green #007A4D (Projects) */
  --color-green-primary: #007A4D;
  --color-green-hover: #006b44;
  --color-green-subtle: #e6f5ef;

  /* Section Accent - Services - SA Flag Blue #002395 */
  --color-blue-primary: #002395;
  --color-blue-hover: #001f82;
  --color-blue-subtle: #e6e8f5;

  /* Section Accent - Tasks - SA Flag Black #000000 */
  --color-black-primary: #000000;
  --color-black-hover: #1a1a1a;
  --color-black-subtle: #f5f5f5;

  /* Section Accent - Charities - SA Flag Red #DE3831 */
  --color-red-primary: #DE3831;
  --color-red-hover: #c4322c;
  --color-red-subtle: #fceaea;

  /* Shared Accent - SA Flag Gold #FFB612 */
  --color-gold-primary: #FFB612;
  --color-gold-hover: #e6a410;
  --color-gold-subtle: #fff8e6;

  --color-shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"],
.dark {
  /* Dark mode */

  /* Backgrounds */
  --color-bg-page: #000000;
  --color-bg-surface: #1a1a1a;
  --color-bg-elevated: #333333;
  --color-bg-muted: #1a1a1a;

  /* Borders */
  --color-border: #4d4d4d;
  --color-border-subtle: #333333;

  /* Text */
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #c2c2c2;
  --color-text-muted: #858585;

  /* SA Flag Colors - slightly lighter for dark mode visibility */
  --color-green-primary: #26a574;
  --color-green-hover: #4db68c;
  --color-green-subtle: #003d27;

  --color-blue-primary: #2638a6;
  --color-blue-hover: #4d5bb6;
  --color-blue-subtle: #001149;

  --color-black-primary: #c2c2c2;
  --color-black-hover: #e0e0e0;
  --color-black-subtle: #333333;

  --color-red-primary: #e95c54;
  --color-red-hover: #ed7872;
  --color-red-subtle: #5b1714;

  --color-gold-primary: #ffcd26;
  --color-gold-hover: #ffd64d;
  --color-gold-subtle: #805c08;

  --color-shadow: rgba(0, 0, 0, 0.4);
}


/* ============================================================
   Typography - Poppins (friendly, playful, modern)
   ============================================================ */

/* All text uses Poppins for a cohesive, friendly look */
body,
h1, h2, h3, h4, h5, h6,
.font-display,
.font-body,
.font-sans {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
}

/* Headings get extra weight for emphasis */
h1, h2, h3 {
  font-weight: 600;
}

h4, h5, h6 {
  font-weight: 500;
}


/* ============================================================
   Groop Approval Rating Dots
   Distinctive 10-point visual rating system
   ============================================================ */

.rating-dots {
  display: flex;
  gap: 2px;
}

.rating-dots.rating-sm .rating-dot { width: 8px; height: 8px; }
.rating-dots.rating-md .rating-dot { width: 10px; height: 10px; }
.rating-dots.rating-lg .rating-dot { width: 12px; height: 12px; }

.rating-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-border);
  transition: background-color 0.15s ease;
}

.rating-dot.filled {
  background-color: var(--color-green-primary);
}

.rating-dot.half {
  background: linear-gradient(90deg, var(--color-green-primary) 50%, var(--color-border) 50%);
}

.rating-dot.pending {
  background-color: var(--color-gold-primary);
}


/* ============================================================
   Toast Notifications
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  animation: toast-slide-in 0.3s ease-out;
  font-family: "Inter", system-ui, sans-serif;
}

.toast.toast-success {
  background-color: var(--color-green-subtle);
  border: 1px solid #86efac;
  color: #166534;
}

.toast.toast-error {
  background-color: var(--color-red-subtle);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.toast.toast-warning {
  background-color: var(--color-gold-subtle);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.toast.toast-info {
  background-color: var(--color-blue-subtle);
  border: 1px solid #93c5fd;
  color: #1e40af;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* ============================================================
   Modal / Dialog
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 50;
  backdrop-filter: blur(2px);
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 51;
}


/* ============================================================
   Artisanal Elements
   Organic shapes that make Groop feel crafted, not templated
   ============================================================ */

/* Morphing blob shape */
.blob {
  border-radius: 42% 56% 72% 28% / 42% 42% 56% 48%;
  animation: blob-morph 8s ease-in-out infinite;
}

@keyframes blob-morph {
  0%, 100% {
    border-radius: 42% 56% 72% 28% / 42% 42% 56% 48%;
  }
  25% {
    border-radius: 72% 28% 48% 48% / 28% 56% 32% 72%;
  }
  50% {
    border-radius: 48% 48% 32% 72% / 56% 28% 72% 28%;
  }
  75% {
    border-radius: 28% 72% 56% 48% / 72% 48% 28% 56%;
  }
}

/* Wave divider between sections */
.wave-divider {
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.wave-divider svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 60px;
}

/* Hand-drawn underline effect */
.underline-hand {
  position: relative;
  display: inline-block;
}

.underline-hand::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10'%3E%3Cpath d='M0 5 Q 25 0, 50 5 T 100 5' stroke='%2322c55e' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}


/* ============================================================
   Progress Bar
   ============================================================ */

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--color-border-subtle);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.3s ease-out;
}

.progress-fill-green { background-color: var(--color-green-primary); }
.progress-fill-gold { background-color: var(--color-gold-primary); }
.progress-fill-blue { background-color: var(--color-blue-primary); }
.progress-fill-red { background-color: var(--color-red-primary); }


/* ============================================================
   Cards
   ============================================================ */

.card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.75rem;
  transition: all 0.15s ease;
}

.card:hover {
  border-color: #86EFAC;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Card color accent strips */
.card-accent-projects { border-top: 3px solid var(--color-green-primary); }
.card-accent-services { border-top: 3px solid var(--color-blue-primary); }
.card-accent-tasks { border-top: 3px solid var(--color-black-primary); }
.card-accent-charities { border-top: 3px solid var(--color-red-primary); }


/* ============================================================
   Buttons - Micro-interactions
   ============================================================ */

.btn {
  transition: all 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}


/* ============================================================
   Form Inputs
   ============================================================ */

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-green-primary);
  box-shadow: 0 0 0 3px var(--color-green-subtle);
}


/* ============================================================
   Loading States
   ============================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-muted) 25%,
    var(--color-border-subtle) 50%,
    var(--color-bg-muted) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.375rem;
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-green-primary);
  border-radius: 50%;
  animation: spinner-spin 0.8s linear infinite;
}

@keyframes spinner-spin {
  to {
    transform: rotate(360deg);
  }
}


/* ============================================================
   Accessibility - Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============================================================
   Focus Visible (keyboard navigation)
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--color-green-primary);
  outline-offset: 2px;
}

.dark :focus-visible {
  outline-color: #4ADE80;
}
