/* ============================================
   DRAWERS
   ============================================

   Side panel overlays for forms, details, and actions.
   Used for: integration setup, domain inspector, redirect editor, etc.

   Features:
   - Slide-in animation from right
   - Overlay backdrop with dimming (no blur for consistency)
   - Loading indicators (brand/cf variants)
   - Responsive mobile optimizations
   ============================================ */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-modal);
  display: flex;
  justify-content: flex-end;
}

.drawer[hidden] {
  display: none;
}

.drawer__overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.drawer__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideIn 200ms ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}

.drawer__header-content {
  flex: 1;
  min-width: 0;
}

.drawer__header-content > .text-muted {
  margin-top: var(--space-1);
}

.drawer__title {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* Add spacing after domain name to separate from action buttons */
.drawer__title .h4 {
  margin-right: var(--space-2);
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.drawer__footer {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--panel);
  overflow: hidden;
}

.drawer__footer > div:not([hidden]) {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Drawer-specific component overrides */
.drawer .empty-state {
  min-height: 120px;
}

.drawer .domain-preview-list {
  max-height: 240px;
  overflow-y: auto;
}

/* Compact textarea in drawer */
.drawer .textarea {
  resize: vertical;
  min-height: calc(1.5em * 6 + var(--space-2) * 2);
  max-height: 40vh;
}

/* Drawer responsive - mobile optimizations */
@media (max-width: 768px) {
  .drawer__panel {
    max-width: 100%;
  }

  .drawer__header {
    padding: var(--space-3);
  }

  .drawer__body {
    padding: var(--space-3);
  }

  .drawer__footer {
    padding: var(--space-3);
  }

  .btn-close {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .btn-close .icon {
    width: 24px;
    height: 24px;
  }
}

/* ============================================
   Locale combobox — typeahead input for site_tag
   (BCP 47 locale picker with free-text fallback)
   ============================================ */
.locale-combobox {
  position: relative;
}
.locale-combobox__input-wrap {
  position: relative;
}
.locale-combobox__input-wrap .input {
  padding-right: var(--space-7);
  width: 100%;
}
.locale-combobox__chevron {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-1);
}
.locale-combobox__chevron:hover {
  color: var(--text);
}
.locale-combobox__menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-1) 0;
  z-index: var(--z-dropdown, 20);
}
.locale-combobox__menu[hidden] {
  display: none;
}
.locale-combobox__code {
  font-family: var(--font-mono, ui-monospace, monospace);
  min-width: 64px;
  display: inline-block;
}
.locale-combobox__empty {
  padding: var(--space-2) var(--space-3);
  margin: 0;
}
