/* components.css - Reusable component styles */
/* Requirements: 2.3, 2.4, 2.6, 7.3, 12.11, 17.5, 17.6 */

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--easing-smooth),
              box-shadow var(--duration-fast) var(--easing-smooth),
              background var(--duration-fast) var(--easing-smooth);
  position: relative;
  overflow: hidden;
}

/* Primary CTA button with accent gradient */
.btn--primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-glow));
  color: hsl(0, 0%, 100%);
  box-shadow: 0 4px 16px hsla(270, 100%, 60%, 0.3);
}

.btn--primary:hover {
  box-shadow: 0 8px 32px hsla(270, 100%, 60%, 0.5),
              0 0 24px hsla(270, 100%, 70%, 0.3);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px hsla(270, 100%, 60%, 0.3);
}

/* Secondary / ghost button */
.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid hsla(270, 100%, 60%, 0.3);
}

.btn--secondary:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 16px hsla(270, 100%, 60%, 0.2);
}

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

/* Focus indicator for all buttons — min 2px outline (WCAG 17.5) */
.btn:focus-visible {
  outline: 2px solid var(--color-accent-glow);
  outline-offset: 3px;
}


/* ==========================================================================
   BADGE - Status badge with pulsing dot
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  background: hsla(270, 100%, 60%, 0.08);
  border: 1px solid hsla(270, 100%, 60%, 0.2);
  border-radius: 100px;
}

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: pulse 2.5s ease-in-out infinite;
}

/* Pulse keyframe for badge dot */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 hsla(270, 100%, 60%, 0.6);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
    box-shadow: 0 0 0 6px hsla(270, 100%, 60%, 0);
  }
}


/* ==========================================================================
   CARDS - Service card with hover effects
   ========================================================================== */

.card {
  position: relative;
  padding: 2rem;
  background: hsla(240, 15%, 10%, 0.6);
  border: 1px solid hsla(270, 100%, 60%, 0.1);
  border-radius: var(--border-radius);
  transition: transform var(--duration-fast) var(--easing-smooth),
              border-color var(--duration-normal) var(--easing-smooth),
              box-shadow var(--duration-normal) var(--easing-smooth);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--color-accent);
  box-shadow: 0 8px 32px hsla(270, 100%, 60%, 0.15),
              0 0 16px hsla(270, 100%, 60%, 0.1);
}

/* Gradient border effect on hover via pseudo-element */
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--border-radius);
  padding: 1px;
  background: linear-gradient(135deg, hsla(270, 100%, 60%, 0), hsla(270, 100%, 60%, 0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: background var(--duration-normal) var(--easing-smooth);
}

.card:hover::before {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-glow));
}

.card__number {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.card__description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* Focus indicator for focusable cards (WCAG 17.5) */
.card:focus-visible {
  outline: 2px solid var(--color-accent-glow);
  outline-offset: 3px;
}


/* ==========================================================================
   GLASSMORPHISM - Limited to max 3 component types (Req 2.4)
   Applied to: 1) Navbar, 2) Badge, 3) Cards
   ========================================================================== */

.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: hsla(240, 15%, 6%, 0.8);
}

.glass--subtle {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: hsla(240, 15%, 8%, 0.6);
}

.glass--card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: hsla(240, 15%, 10%, 0.6);
}


/* ==========================================================================
   FORM FIELDS - Floating label pattern with focus animation
   ========================================================================== */

.form-field {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-field__input,
.form-field__textarea,
.form-field__select {
  width: 100%;
  padding: 1.25rem 1rem 0.75rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: hsla(240, 15%, 10%, 0.6);
  border: 1px solid hsla(270, 100%, 60%, 0.15);
  border-radius: calc(var(--border-radius) / 1.5);
  outline: none;
  transition: border-color var(--duration-fast) var(--easing-smooth),
              box-shadow var(--duration-fast) var(--easing-smooth);
}

.form-field__textarea {
  min-height: 140px;
  resize: vertical;
}

.form-field__select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Floating label */
.form-field__label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  pointer-events: none;
  transition: transform var(--duration-fast) var(--easing-smooth),
              font-size var(--duration-fast) var(--easing-smooth),
              color var(--duration-fast) var(--easing-smooth);
}

/* Label positioning for textarea */
.form-field--textarea .form-field__label {
  top: 1.25rem;
  transform: translateY(0);
}

/* Float label on focus or when input has content */
.form-field__input:focus ~ .form-field__label,
.form-field__input:not(:placeholder-shown) ~ .form-field__label,
.form-field__textarea:focus ~ .form-field__label,
.form-field__textarea:not(:placeholder-shown) ~ .form-field__label,
.form-field__select:focus ~ .form-field__label,
.form-field__select:not([value=""]) ~ .form-field__label {
  transform: translateY(-1.5rem);
  font-size: 0.75rem;
  color: var(--color-accent);
}

/* Textarea floating label adjustment */
.form-field--textarea .form-field__input:focus ~ .form-field__label,
.form-field--textarea .form-field__textarea:focus ~ .form-field__label,
.form-field--textarea .form-field__textarea:not(:placeholder-shown) ~ .form-field__label {
  transform: translateY(-1rem);
  font-size: 0.75rem;
  color: var(--color-accent);
}

/* Focus state - animated border + glow (Req 12.11) */
.form-field__input:focus,
.form-field__textarea:focus,
.form-field__select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px hsla(270, 100%, 60%, 0.15),
              0 0 12px hsla(270, 100%, 60%, 0.1);
}

/* Focus-visible for keyboard users (WCAG 17.5) */
.form-field__input:focus-visible,
.form-field__textarea:focus-visible,
.form-field__select:focus-visible {
  outline: 2px solid var(--color-accent-glow);
  outline-offset: 2px;
}

/* Validation error state */
.form-field--error .form-field__input,
.form-field--error .form-field__textarea,
.form-field--error .form-field__select {
  border-color: hsl(0, 80%, 60%);
  box-shadow: 0 0 0 3px hsla(0, 80%, 60%, 0.1);
}

.form-field--error .form-field__label {
  color: hsl(0, 80%, 60%);
}

.form-field__error {
  display: none;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(0, 80%, 60%);
  line-height: 1.4;
}

.form-field--error .form-field__error {
  display: block;
}

/* Success state */
.form-field--success .form-field__input,
.form-field--success .form-field__textarea,
.form-field--success .form-field__select {
  border-color: hsl(145, 70%, 45%);
}


/* ==========================================================================
   FOCUS INDICATORS - Global visible focus styles (WCAG 17.5)
   Minimum 2px outline on all interactive elements
   ========================================================================== */

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent-glow);
  outline-offset: 2px;
}


/* ==========================================================================
   LINK STYLES
   ========================================================================== */

.link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-smooth);
}

.link:hover {
  color: var(--color-accent-glow);
}

.link:focus-visible {
  outline: 2px solid var(--color-accent-glow);
  outline-offset: 3px;
}


/* ==========================================================================
   FORM MESSAGES (success/error feedback)
   ========================================================================== */

.form-message {
  padding: 1rem 1.25rem;
  border-radius: calc(var(--border-radius) / 1.5);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.form-message--success {
  background: hsla(145, 70%, 45%, 0.1);
  border: 1px solid hsla(145, 70%, 45%, 0.3);
  color: hsl(145, 70%, 55%);
}

.form-message--error {
  background: hsla(0, 80%, 60%, 0.1);
  border: 1px solid hsla(0, 80%, 60%, 0.3);
  color: hsl(0, 80%, 65%);
}


/* ==========================================================================
   LOADING SPINNER (for form submission)
   ========================================================================== */

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid hsla(0, 0%, 100%, 0.3);
  border-top-color: hsl(0, 0%, 100%);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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