/**
 * Reconomy Gateway App Panel v1.0.0
 * Standalone app launcher panel (waffle menu) for Reconomy platform.
 * Zero external dependencies — works in any web app.
 */

/* ── Trigger Button (waffle / 3x3 dot grid) ── */

.reconomy-gateway-app-panel__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border-radius: 0;
  transition: background 0.2s ease;
  position: relative;
  z-index: 10000;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.reconomy-gateway-app-panel__trigger:hover {
  background: rgba(255, 255, 255, 0.15);
}

.reconomy-gateway-app-panel__trigger:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.reconomy-gateway-app-panel__trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.25);
}

/* Waffle icon: 3x3 grid of dots */

.reconomy-gateway-app-panel__waffle {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
  pointer-events: none;
}

.reconomy-gateway-app-panel__waffle-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffffff;
}

/* ── Backdrop (invisible click-catcher for closing) ── */

.reconomy-gateway-app-panel__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: transparent;
}

/* ── Panel ── */

.reconomy-gateway-app-panel__panel {
  position: fixed;
  top: 64px;
  left: 0;
  width: 420px;
  max-height: calc(100vh - 64px);
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.13), 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 10000;
  overflow-y: auto;
  padding: 20px 16px 16px 24px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
  border-radius: 8px;

  /* Closed state */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.reconomy-gateway-app-panel__panel--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Panel Header (optional) ── */

.reconomy-gateway-app-panel__header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #3c3c3c;
  margin: 0 0 16px 4px;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.4;
}

/* ── App Tiles Grid (3 columns) ── */

.reconomy-gateway-app-panel__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* ── Single Tile ── */

.reconomy-gateway-app-panel__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 6px 12px;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  color: #3c3c3c;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-sizing: border-box;
}

.reconomy-gateway-app-panel__tile:hover {
  background: #f5f5f5;
  text-decoration: none;
  color: #3c3c3c;
}

.reconomy-gateway-app-panel__tile:focus-visible {
  background: #f5f5f5;
  outline: 2px solid #005596;
  outline-offset: -2px;
  text-decoration: none;
  color: #3c3c3c;
}

/* ── Current / Active App Tile ── */

.reconomy-gateway-app-panel__tile--current {
  border-color: #005596;
  background: #f0f7ff;
}

.reconomy-gateway-app-panel__tile--current:hover {
  background: #e4effa;
}

/* ── Tile Icon / Image Container ── */

.reconomy-gateway-app-panel__tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.reconomy-gateway-app-panel__tile-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Letter avatar fallback */

.reconomy-gateway-app-panel__tile-icon--letter {
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Tile Label ── */

.reconomy-gateway-app-panel__tile-label {
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: #3c3c3c;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Responsive ── */

@media (max-width: 576px) {
  .reconomy-gateway-app-panel__panel {
    width: 100vw;
    left: 0;
    right: 0;
    border-radius: 0;
  }
}
