/**
 * Woot.ro - Location Picker Styles
 *
 * Styles for the block checkout location picker.
 *
 * @since 2.2.0
 */

// Location Picker Container
.woot-location-picker {
  margin-top: 16px;

  &__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background-color: var(--wp--preset--color--primary, #000);
    color: var(--wp--preset--color--background, #fff);
    transition: opacity 0.2s ease;

    &:hover {
      opacity: 0.9;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    svg {
      flex-shrink: 0;
    }
  }
}

// Location Card
.woot-location-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f8faf8 0%, #f0f7f0 100%);
  border-radius: 8px;
  border: 1px solid #c8e6c9;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);

  // Success checkmark indicator
  &::before {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background-color: #4caf50;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
  }

  &__logo {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

    img {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
    }
  }

  &__info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
  }

  &__name {
    font-weight: 600;
    font-size: 15px;
    color: #1b5e20;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  &__address {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
  }
}

// Modal
.woot-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 20px;

  &--open {
    display: flex;
  }

  &__content {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    max-height: 700px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  &__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
  }

  &__title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }

  &__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;

    &:hover {
      background-color: #e0e0e0;
      color: #333;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }

  &__body {
    flex: 1;
    position: relative;
    overflow: hidden;

    iframe {
      width: 100%;
      height: 100%;
      border: none;
    }
  }

  &__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    font-size: 14px;
    color: #333;
  }

  &__spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--wp--preset--color--primary, #000);
    border-radius: 50%;
    animation: woot-spin 0.8s linear infinite;
  }
}

@keyframes woot-spin {
  to {
    transform: rotate(360deg);
  }
}

// Responsive
@media (max-width: 768px) {
  .woot-modal {
    padding: 10px;

    &__content {
      max-height: none;
      height: calc(100vh - 20px);
    }
  }

  .woot-location-picker__button {
    width: 100%;
    justify-content: center;
  }
}
