/**
 * Edit Drawer Styles
 * Phase 2: Mobile Builder Redesign
 *
 * Components:
 * - Edit Tab (collapsed state) - visible on left edge
 * - Edit Drawer (expanded state) - slide-in panel with options
 * - Overlay for dismissing drawer
 */

/* ========================================
   EDIT TAB (Collapsed State)
   ======================================== */

.edit-drawer-tab {
  position: fixed;
  left: 0;
  top: 30%;
  transform: translateY(-50%);
  z-index: 1095; /* Above preview panel (1090), below header (1100) */

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;

  width: 60px;
  height: 90px;
  padding: 12px 8px;

  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: none;
  border-radius: 0 16px 16px 0;
  box-shadow: 6px 0 12px rgba(0, 0, 0, 0.28);

  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.edit-drawer-tab:hover {
  width: 52px;
  box-shadow: 3px 0 16px rgba(0, 0, 0, 0.12);
}

.edit-drawer-tab:active {
  background: #f8f8f8;
  transform: translateY(-50%) scale(0.98);
}

.edit-drawer-tab-icon {
  width: 24px;
  height: 24px;
  color: #444;
}

.edit-drawer-tab-label {
  font-family: 'Gilroy', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  letter-spacing: 0.02em;
}

/* Hidden when drawer is open */
.edit-drawer-tab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-100%);
}

/* Hide on steps without drawer (Step-2, Step-4) */
.edit-drawer-tab[hidden] {
  display: none !important;
}

/* ========================================
   EDIT DRAWER (Expanded State)
   ======================================== */

.edit-drawer {
  position: fixed;
  top: calc(var(--mobile-head-h, 100px) + env(safe-area-inset-top, 0px));
  left: 0;
  bottom: 0;

  width: 120px;
  background: white;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);

  z-index: 1100;

  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* Safe area for notch devices */
  padding-left: env(safe-area-inset-left, 0px);
}

.edit-drawer.is-open {
  transform: translateX(0);
}

.edit-drawer-content {
  padding: 16px 12px;
}

/* Options container - one for each step */
.edit-drawer-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-drawer-options[hidden] {
  display: none;
}

/* ========================================
   DRAWER OPTION BUTTONS
   ======================================== */

.edit-drawer-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;

  width: 100%;
  padding: 16px 8px;

  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 12px;

  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.edit-drawer-option:hover {
  background: #f0f0f0;
}

.edit-drawer-option:active {
  background: #e8e8e8;
  transform: scale(0.98);
}

/* Selected state */
.edit-drawer-option.is-selected {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(124, 58, 237, 0.08));
  border-color: rgba(147, 51, 234, 0.3);
}

.edit-drawer-option.is-selected .edit-drawer-option-label {
  color: #7c3aed;
}

.edit-drawer-option-icon {
  font-size: 24px;
  line-height: 1;
}

/* SVG icon variant */
.edit-drawer-option-icon svg {
  width: 24px;
  height: 24px;
  color: #444;
}

.edit-drawer-option-label {
  font-family: 'Gilroy', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-align: center;
  line-height: 1.2;
}

/* ========================================
   DRAWER OVERLAY
   ======================================== */

.edit-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1096; /* Above preview panel (1090) and edit-drawer-tab (1095), below drawer (1100) */

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;

  /* Ensure it's under the drawer but above content */
  pointer-events: none;
}

.edit-drawer-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Larger phones / small tablets */
@media (min-width: 428px) {
  .edit-drawer {
    width: 160px;
  }

  .edit-drawer-tab {
    width: 52px;
    height: 88px;
  }

  .edit-drawer-option {
    padding: 18px 10px;
  }
}

/* Desktop - hide completely */
@media (min-width: 769px) {
  .edit-drawer-tab,
  .edit-drawer,
  .edit-drawer-overlay {
    display: none !important;
  }
}

/* Short phones (landscape or small screens) */
@media (max-height: 600px) {
  .edit-drawer-option {
    padding: 12px 8px;
    gap: 4px;
  }

  .edit-drawer-option-icon {
    font-size: 20px;
  }

  .edit-drawer-option-label {
    font-size: 10px;
  }
}

/* Safe area adjustments for notched devices */
@supports (padding: env(safe-area-inset-left)) {
  .edit-drawer {
    padding-left: env(safe-area-inset-left);
  }
}
