/**
 * TRANZITA ACADEMY — PUBLIC COMPONENTS
 * Interactive buttons, form inputs, badges, modals, drawers, and security states.
 */

/* ==========================================================================
   Buttons (Guaranteed WCAG 2.5.5 Touch Targets >= 44x44px)
   ========================================================================== */
.tz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tz-space-2);
  min-height: var(--tz-touch-min);
  padding: 10px 22px;
  font-size: var(--tz-text-sm);
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--tz-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--tz-transition-fast);
  text-align: center;
  user-select: none;
  white-space: nowrap;
}

.tz-btn:focus-visible {
  outline: 2px solid var(--tz-primary);
  outline-offset: 2px;
}

.tz-btn-primary {
  background-color: var(--tz-accent);
  color: var(--tz-text-inverse);
  box-shadow: 0 2px 8px rgba(245, 126, 96, 0.28);
}

.tz-btn-primary:hover {
  background-color: var(--tz-accent-hover);
  color: var(--tz-text-inverse);
  box-shadow: 0 4px 14px rgba(245, 126, 96, 0.38);
  transform: translateY(-1px);
}

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

.tz-btn-secondary {
  background-color: var(--tz-primary);
  color: var(--tz-text-inverse);
}

.tz-btn-secondary:hover {
  background-color: var(--tz-primary-hover);
  color: var(--tz-text-inverse);
  transform: translateY(-1px);
}

.tz-btn-navy {
  background-color: var(--tz-navy);
  color: var(--tz-text-inverse);
}

.tz-btn-navy:hover {
  background-color: var(--tz-navy-soft);
  color: var(--tz-text-inverse);
}

.tz-btn-outline {
  background-color: transparent;
  color: var(--tz-navy);
  border-color: var(--tz-border-medium);
}

.tz-btn-outline:hover {
  background-color: var(--tz-bg-subtle);
  border-color: var(--tz-navy);
  color: var(--tz-navy);
}

.tz-btn-outline-white {
  background-color: transparent;
  color: var(--tz-text-inverse);
  border-color: rgba(255, 255, 255, 0.3);
}

.tz-btn-outline-white:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--tz-text-inverse);
  color: var(--tz-text-inverse);
}

.tz-btn-ghost {
  background-color: transparent;
  color: var(--tz-text-secondary);
}

.tz-btn-ghost:hover {
  background-color: var(--tz-bg-subtle);
  color: var(--tz-navy);
}

.tz-btn-lg {
  min-height: 50px;
  padding: 14px 28px;
  font-size: var(--tz-text-base);
}

.tz-btn-sm {
  min-height: var(--tz-touch-min); /* Maintained for WCAG */
  padding: 8px 16px;
  font-size: var(--tz-text-xs);
}

.tz-btn-full {
  width: 100%;
}

.tz-btn-icon-right {
  display: inline-flex;
  align-items: center;
  transition: transform var(--tz-transition-fast);
}

.tz-btn:hover .tz-btn-icon-right {
  transform: translateX(4px);
}

[dir="rtl"] .tz-btn:hover .tz-btn-icon-right {
  transform: translateX(-4px);
}

/* ==========================================================================
   Badges & Tags
   ========================================================================== */
.tz-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--tz-text-xs);
  font-weight: 600;
  border-radius: var(--tz-radius-pill);
  line-height: 1.2;
}

.tz-badge-gold {
  background-color: var(--tz-gold-light);
  color: #8C5B23;
  border: 1px solid rgba(212, 163, 115, 0.3);
}

.tz-badge-coral {
  background-color: var(--tz-accent-light);
  color: #C84626;
  border: 1px solid rgba(245, 126, 96, 0.3);
}

.tz-badge-teal {
  background-color: var(--tz-primary-light);
  color: var(--tz-primary-dark);
  border: 1px solid rgba(45, 95, 121, 0.2);
}

.tz-badge-neutral {
  background-color: var(--tz-bg-subtle);
  color: var(--tz-text-secondary);
  border: 1px solid var(--tz-border-subtle);
}

/* ==========================================================================
   Form Controls & Admissions Inputs
   ========================================================================== */
.tz-form {
  display: flex;
  flex-direction: column;
  gap: var(--tz-space-5);
}

.tz-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tz-space-4);
}

.tz-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.tz-form-label {
  font-size: var(--tz-text-xs);
  font-weight: 600;
  color: var(--tz-text-headline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tz-form-req {
  color: var(--tz-accent);
  margin-left: 2px;
}

.tz-form-control {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--tz-text-sm);
  color: var(--tz-text-headline);
  background-color: var(--tz-bg-surface);
  border: 1px solid var(--tz-border-medium);
  border-radius: var(--tz-radius-md);
  transition: border-color var(--tz-transition-fast), box-shadow var(--tz-transition-fast);
}

.tz-form-control:focus {
  outline: none;
  border-color: var(--tz-primary);
  box-shadow: 0 0 0 3px rgba(45, 95, 121, 0.15);
}

.tz-form-control::placeholder {
  color: var(--tz-text-muted);
}

textarea.tz-form-control {
  min-height: 96px;
  resize: vertical;
}

.tz-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 36px;
}

[dir="rtl"] .tz-form-select {
  background-position: left 14px center;
  padding-right: 14px;
  padding-left: 36px;
}

/* Security Honeypot (Invisible to Humans, Trap for Spambots) */
.tz-hp-trap {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

/* Form Helper & Feedback */
.tz-form-feedback {
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-top: 2px;
}

.tz-form-feedback.error {
  color: #DC2626;
}

.tz-form-privacy-note {
  font-size: var(--tz-text-xs);
  color: var(--tz-text-secondary);
  line-height: 1.5;
  background-color: var(--tz-bg-subtle);
  padding: var(--tz-space-3);
  border-radius: var(--tz-radius-md);
  border: 1px solid var(--tz-border-subtle);
}

/* Submission Result Card */
.tz-result-card {
  display: none;
  background-color: var(--tz-bg-surface);
  border: 1px solid var(--tz-status-success);
  border-radius: var(--tz-radius-xl);
  padding: var(--tz-space-8);
  text-align: center;
  box-shadow: var(--tz-shadow-md);
}

.tz-result-card.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tz-result-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--tz-radius-pill);
  background-color: var(--tz-status-success-bg);
  color: var(--tz-status-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--tz-space-4);
}

.tz-result-ref {
  display: inline-block;
  font-family: var(--tz-font-mono);
  font-size: var(--tz-text-sm);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--tz-radius-sm);
  background-color: var(--tz-bg-subtle);
  color: var(--tz-navy);
  margin-top: var(--tz-space-2);
  margin-bottom: var(--tz-space-4);
  letter-spacing: 0.05em;
  border: 1px dashed var(--tz-border-medium);
}

/* ==========================================================================
   Mobile Off-Canvas Navigation Drawer
   ========================================================================== */
.tz-mobile-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 25, 36, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tz-transition-normal);
}

.tz-mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.tz-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85%;
  max-width: 360px;
  background-color: var(--tz-bg-surface);
  z-index: 101;
  box-shadow: var(--tz-shadow-xl);
  display: none;
  flex-direction: column;
  padding: var(--tz-space-6);
  overflow-y: auto;
}

[dir="rtl"] .tz-mobile-drawer {
  right: auto;
  left: 0;
}

.tz-mobile-drawer.active {
  display: flex;
}

.tz-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--tz-space-4);
  border-bottom: 1px solid var(--tz-border-subtle);
  margin-bottom: var(--tz-space-6);
}

.tz-drawer-close-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tz-navy);
  border-radius: var(--tz-radius-md);
  border: 1px solid var(--tz-border-subtle);
}

.tz-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--tz-space-3);
  list-style: none;
  margin-bottom: var(--tz-space-8);
}

.tz-drawer-link {
  font-size: var(--tz-text-md);
  font-weight: 600;
  color: var(--tz-navy);
  padding: 10px 0;
  min-height: var(--tz-touch-min);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--tz-border-subtle);
}

.tz-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: var(--tz-space-3);
  margin-top: auto;
}

/* ==========================================================================
   Student Portal & Login Gateway Card
   ========================================================================== */
.tz-login-wrapper {
  max-width: 480px;
  margin: var(--tz-space-12) auto;
  padding: var(--tz-space-8);
  background-color: var(--tz-bg-surface);
  border: 1px solid var(--tz-border-subtle);
  border-radius: var(--tz-radius-xl);
  box-shadow: var(--tz-shadow-lg);
}

.tz-login-head {
  text-align: center;
  margin-bottom: var(--tz-space-6);
}

.tz-login-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--tz-radius-pill);
  background-color: var(--tz-primary-light);
  color: var(--tz-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--tz-space-3);
}

.tz-login-notice {
  font-size: var(--tz-text-xs);
  color: var(--tz-text-secondary);
  background-color: var(--tz-bg-subtle);
  padding: var(--tz-space-3);
  border-radius: var(--tz-radius-md);
  border-left: 3px solid var(--tz-primary);
  margin-bottom: var(--tz-space-6);
  line-height: 1.5;
}

[dir="rtl"] .tz-login-notice {
  border-left: none;
  border-right: 3px solid var(--tz-primary);
}

@media (max-width: 640px) {
  .tz-form-row {
    grid-template-columns: 1fr;
  }
}
