﻿/**
 * Currency Converter Widget Styles
 * Lightweight and modern design for the currency selector widget
 */

:root {
  --selo-bg: #ffffff;
  --selo-text: #111827;
  --selo-hover: #e5e7eb;
  --selo-border: #d1d5db;
  --selo-shadow: rgba(0, 0, 0, 0.1);
  --selo-transition: all 0.2s ease;
}

/* Main Widget Container */
.selo-converter-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  background: var(--selo-bg);
  color: var(--selo-text);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--selo-shadow);
  user-select: none;
  z-index: 999999;
  position: relative;
  width: fit-content;
}

/* Widget Trigger Button */
.selo-widget-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--selo-transition);
  background: var(--selo-bg);
  white-space: nowrap;
}

.selo-widget-trigger:hover {
  background: var(--selo-hover);
}

.selo-widget-trigger.selo-trigger-active {
  background: var(--selo-hover);
}

/* Flag Image */
.selo-flag {
  object-fit: cover;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 14px;
}

/* Flag Shape Variations */
.selo-flag-circle {
  border-radius: 50%;
  width: 20px;
  height: 20px;
}

.selo-flag-rounded {
  border-radius: 4px;
}

.selo-flag-rectangle {
  border-radius: 0;
}

/* Currency Code */
.selo-currency-code {
  font-weight: 600;
  font-size: 14px;
  color: var(--selo-text);
}

/* Auto Label - shown in trigger when currency is auto-detected */
.selo-auto-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--selo-text);
  opacity: 0.8;
}

/* Auto Location Label - shown in dropdown for auto-detected currency */
.selo-auto-location-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--selo-text);
}

/* Chevron Icon */
.selo-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
  color: var(--selo-text);
  opacity: 0.6;
}

/* Chevron rotation is handled by JS based on dropdown position */

/* Dropdown Container */
.selo-dropdown {
  position: absolute !important;
  min-width: auto;
  width: max-content;
  max-width: 300px;
  background: var(--selo-bg);
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--selo-shadow);
  overflow: hidden;
  max-height: 300px;
  min-height: 50px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: var(--selo-transition);
  z-index: 999999;
  /* Initial position - JS will override these */
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  /* hide scrollbar track */
  scrollbar-width: none;
}

/* Open state */
.selo-dropdown.selo-dropdown-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Top positioning (opens upward) */
.selo-dropdown.selo-dropdown-top.selo-dropdown-open {
  transform: translateY(0);
}

.selo-dropdown.selo-dropdown-top {
  transform: translateY(10px);
}

/* Bottom positioning (opens downward) - default */
.selo-dropdown.selo-dropdown-bottom.selo-dropdown-open {
  transform: translateY(0);
}

.selo-dropdown.selo-dropdown-bottom {
  transform: translateY(-10px);
}

/* Horizontal alignment classes */
.selo-dropdown.selo-dropdown-left {
  left: 0;
  right: auto;
}

.selo-dropdown.selo-dropdown-right {
  left: auto;
  right: 0;
}

/* Dropdown Items */
.selo-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--selo-transition);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.selo-dropdown-item:last-child {
  border-bottom: none;
}

.selo-dropdown-item:hover {
  background: var(--selo-hover);
}

/* Active dropdown item (currently selected currency) */
.selo-dropdown-item-active {
  background: var(--selo-hover);
  font-weight: 600;
}

.selo-dropdown-item-active:hover {
  background: var(--selo-hover);
}

/* Checkmark for active item */
.selo-checkmark {
  color: var(--selo-text);
  opacity: 0.8;
  flex-shrink: 0;
}

/* Currency Info Container */
.selo-currency-info {
  display: inline;
}

.selo-currency-info .selo-currency-code {
  font-weight: 600;
  font-size: 14px;
}

.selo-currency-name {
  font-size: 12px;
  color: var(--selo-text);
  opacity: 0.6;
}

/* Border Styles */
.selo-converter-widget.selo-border-line {
  border: 1px solid var(--selo-border);
}

.selo-converter-widget.selo-border-shadow {
  box-shadow: 0 4px 12px var(--selo-shadow);
}

.selo-converter-widget.selo-border-none {
  border: none;
  box-shadow: 0 2px 4px var(--selo-shadow);
}

/* Dark Mode */
.selo-converter-widget.selo-dark-mode {
  --selo-bg: #1f2937;
  --selo-text: #f9fafb;
  --selo-hover: #374151;
  --selo-border: #4b5563;
  --selo-shadow: rgba(0, 0, 0, 0.3);
}

.selo-converter-widget.selo-dark-mode .selo-dropdown-item {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Scrollbar Styles */
.selo-dropdown::-webkit-scrollbar {
  width: 6px;
}

.selo-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.selo-dropdown::-webkit-scrollbar-thumb {
  background: var(--selo-border);
  border-radius: 3px;
}

.selo-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--selo-text);
  opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .selo-converter-widget {
    font-size: 13px;
  }

  .selo-widget-trigger {
    padding: 8px 12px;
    min-width: 90px;
  }

  .selo-flag {
    width: 20px;
    height: 14px;
  }

  .selo-currency-code {
    font-size: 13px;
  }

  .selo-dropdown {
    max-height: 250px;
  }

  .selo-dropdown-item {
    padding: 10px 12px;
  }

  .selo-currency-name {
    font-size: 11px;
  }
}

/* Animation for widget appearance */
@keyframes seloFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.selo-converter-widget {
  animation: seloFadeIn 0.3s ease;
}

/* Positioning Classes */
.selo-converter-widget[style*="position: fixed"] {
  position: fixed !important;
}

/* Accessibility */
.selo-widget-trigger:focus,
.selo-dropdown-item:focus {
  outline: 2px solid var(--selo-text);
  outline-offset: 2px;
}

/* Loading State */
.selo-converter-widget.selo-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Error State */
.selo-converter-widget.selo-error {
  border-color: #ef4444;
}

/* Hidden State */
.selo-converter-widget.selo-hidden {
  display: none;
}

/* Custom Position Support */
.selo-converter-widget.selo-custom-position {
  position: relative !important;
}

/* Widget in custom position should be inline */
.selo-converter-widget[style*="position: relative"] {
  display: inline-block !important;
  vertical-align: middle;
}

/* Ensure dropdown works correctly for both floating and custom positioning */
.selo-converter-widget[style*="position: fixed"] .selo-dropdown {
  position: absolute;
}

.selo-converter-widget[style*="position: relative"] .selo-dropdown {
  position: absolute;
}

/* Compact Mode for Small Screens */
@media (max-width: 480px) {
  .selo-converter-widget {
    border-radius: 6px;
  }

  .selo-widget-trigger {
    padding: 6px 10px;
    gap: 6px;
  }

  .selo-dropdown {
    border-radius: 6px;
  }
}

/* Print Styles */
@media print {
  .selo-converter-widget {
    display: none !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  .selo-converter-widget,
  .selo-widget-trigger,
  .selo-dropdown,
  .selo-dropdown-item,
  .selo-chevron {
    transition: none !important;
    animation: none !important;
  }
}

/* Cart Notification Banner */
.selo-cart-notification {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
  transition: opacity 0.3s ease;
}

.selo-cart-notification-wrapper {
  margin-bottom: 16px;
}

/* Animation for cart notification */
@keyframes seloCartNotificationFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.selo-cart-notification:not([style*="display: none"]) {
  animation: seloCartNotificationFadeIn 0.3s ease;
}