/* ========================================================================
   KarPayı — Mobile Drawer (lazy)
   Accordion extension for the offcanvas drawer. Consumes the same
   PublicNav::panels() manifest as the desktop mega menu; mobile-specific
   rendering sacrifices aside width for vertical ergonomics.

   Load AFTER foundation.css + app.css (which owns .kp-drawer-link base).
   Active at all breakpoints because the drawer itself is mobile-first;
   desktop >=lg shows the mega menu instead and never opens the drawer.

   BEM family: `kp-drawer-section__*`, `kp-drawer-item*`,
   `kp-drawer-section__feature*`.

   Contract: design-system-agreement.md §14 Mobile Drawer Contract.
   ======================================================================== */

/* =====================================================================
   1. SECTION (accordion wrapper)
   ===================================================================== */
.kp-drawer-section {
  border-bottom: 1px solid var(--border);
}

.kp-drawer-section__trigger {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: transparent;
  border: 0;
  text-align: left;
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.kp-drawer-section__trigger:hover,
.kp-drawer-section__trigger:focus-visible {
  background-color: var(--surface-2);
  color: var(--text-1);
}

.kp-drawer-section__trigger[aria-expanded="true"] {
  color: var(--primary);
  background-color: var(--surface-2);
}

.kp-drawer-section__trigger-icon {
  width: 20px;
  height: 20px;
  color: var(--text-2);
}

.kp-drawer-section__trigger[aria-expanded="true"] .kp-drawer-section__trigger-icon {
  color: var(--primary);
}

.kp-drawer-section__chevron {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: transform var(--duration-fast) var(--ease-out);
}

.kp-drawer-section__trigger[aria-expanded="true"] .kp-drawer-section__chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* =====================================================================
   2. PANEL (expanded content)
   ===================================================================== */
.kp-drawer-section__panel {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: var(--space-2) 0 var(--space-3) 0;
}

.kp-drawer-section__group {
  padding: var(--space-2) 0;
}

.kp-drawer-section__group + .kp-drawer-section__group {
  border-top: 1px solid var(--border);
}

.kp-drawer-section__group-label {
  margin: 0;
  padding: var(--space-2) 1.25rem var(--space-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-wider, 0.08em);
  color: var(--muted);
  text-transform: uppercase;
}

.kp-drawer-section__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* =====================================================================
   3. ITEM (sub-link inside accordion)
   ===================================================================== */
.kp-drawer-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: 0.625rem 1.25rem 0.625rem 2rem;
  color: var(--text-1);
  text-decoration: none;
  font-size: var(--fs-sm);
  line-height: 1.3;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.kp-drawer-item:hover,
.kp-drawer-item:focus-visible {
  background-color: var(--surface-3);
  color: var(--primary);
}

.kp-drawer-item--active {
  color: var(--primary);
  background-color: var(--primary-subtle);
  font-weight: 500;
}

.kp-drawer-item__icon {
  width: 18px;
  height: 18px;
  color: var(--text-2);
  flex-shrink: 0;
}

.kp-drawer-item:hover .kp-drawer-item__icon,
.kp-drawer-item:focus-visible .kp-drawer-item__icon,
.kp-drawer-item--active .kp-drawer-item__icon {
  color: var(--primary);
}

.kp-drawer-item__label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.kp-drawer-item__badge {
  margin-left: var(--space-1);
}

.kp-drawer-item--disabled {
  color: var(--text-3);
  cursor: not-allowed;
}

.kp-drawer-item--disabled .kp-drawer-item__icon {
  color: var(--text-3);
  opacity: 0.7;
}

.kp-drawer-item--disabled:hover,
.kp-drawer-item--disabled:focus-visible {
  background-color: transparent;
  color: var(--text-3);
}

/* =====================================================================
   4. FEATURE CTA (compact aside, mobile)
   ===================================================================== */
.kp-drawer-section__feature {
  margin: var(--space-3) 1.25rem 0;
  padding: var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kp-drawer-section__feature-title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
}

.kp-drawer-section__feature-body {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.45;
}

.kp-drawer-section__feature-cta {
  align-self: flex-start;
  margin-top: var(--space-1);
}

/* =====================================================================
   5. BANK PICKER BLOCK (preserved but aligned with accordion aesthetic)
   ===================================================================== */
.kp-drawer-bank-picker {
  border-top: 1px solid var(--border);
  padding: var(--space-3) 0 var(--space-2);
}

.kp-drawer-bank-picker__label {
  margin: 0 0 var(--space-1);
  padding: 0 1.25rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-wider, 0.08em);
  color: var(--muted);
  text-transform: uppercase;
}

.kp-drawer-bank-picker__item {
  padding: 0.625rem 1.25rem;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-1);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.kp-drawer-bank-picker__item:hover,
.kp-drawer-bank-picker__item:focus-visible {
  background-color: var(--surface-2);
  color: var(--primary);
}

.kp-drawer-bank-picker__item-logo {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-1);
  object-fit: contain;
}

.kp-drawer-bank-picker__all {
  color: var(--primary);
  font-weight: 500;
}
