/**
 * Selection Sheet Component Styles
 * Mobile-native full-screen selection sheet with desktop modal fallback
 */

/* Backdrop */
.selection-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9998;
  backdrop-filter: blur(4px);
}

.selection-sheet-backdrop-visible {
  opacity: 1;
  visibility: visible;
}

/* Sheet Container */
.selection-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.selection-sheet-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Desktop: Centered Modal */
@media (min-width: 768px) {
  .selection-sheet {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.95);
    width: 40%;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }

  .selection-sheet-open {
    transform: translate(-50%, -50%) scale(1);
  }

  .selection-sheet-backdrop {
    backdrop-filter: blur(8px);
  }
}

/* Header */
.selection-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  flex-shrink: 0;
}

.selection-sheet-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text, #000);
  flex: 1;
}

.selection-sheet-clear {
  background: none;
  border: none;
  color: var(--accent, #c47e42);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  margin-right: 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.selection-sheet-clear:hover {
  background: var(--accent-soft, rgba(196, 126, 66, 0.1));
}

.selection-sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted, #666);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  padding: 0;
}

.selection-sheet-close:hover {
  background: var(--accent-soft, rgba(196, 126, 66, 0.1));
  color: var(--text, #000);
}

/* Content Area */
.selection-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.selection-sheet-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted, #666);
  font-size: 14px;
}

/* Option Items */
.selection-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  min-height: 48px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.selection-sheet-item:hover {
  background: var(--accent-soft, rgba(196, 126, 66, 0.08));
}

.selection-sheet-item:focus {
  outline: 2px solid var(--accent, #c47e42);
  outline-offset: -2px;
}

.selection-sheet-item[aria-selected="true"] {
  background: var(--accent-soft, rgba(196, 126, 66, 0.12));
}

/* Checkbox */
.selection-sheet-checkbox {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent, #c47e42);
}

/* Avatar */
.selection-sheet-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft, rgba(196, 126, 66, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent, #c47e42);
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

/* Item Text */
.selection-sheet-item-text {
  flex: 1;
  min-width: 0;
}

.selection-sheet-item-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text, #000);
  margin-bottom: 2px;
}

.selection-sheet-item-description {
  font-size: 13px;
  color: var(--text-muted, #666);
  line-height: 1.4;
  opacity: 0.8;
}

/* Footer */
.selection-sheet-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  flex-shrink: 0;
  background: var(--surface, #fff);
}

.selection-sheet-done {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
}

/* Selection Sheet Button (Pill) */
.selection-sheet-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid var(--border, rgba(196, 126, 66, 0.3));
  border-radius: 24px;
  background: var(--surface, #fff);
  color: var(--text, #000);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  width: 100%;
  text-align: left;
}

.selection-sheet-button:hover {
  border-color: var(--accent, #c47e42);
  background: var(--accent-soft, rgba(196, 126, 66, 0.05));
}

.selection-sheet-button:focus {
  outline: 2px solid var(--accent, #c47e42);
  outline-offset: 2px;
}

.selection-sheet-button--has-selection {
  background: linear-gradient(135deg, var(--accent-soft, rgba(196, 126, 66, 0.1)), var(--accent-soft, rgba(196, 126, 66, 0.05)));
  border-color: var(--accent, #c47e42);
  color: var(--text, #000);
}

.selection-sheet-button::after {
  content: '▾';
  font-size: 12px;
  color: var(--text-muted, #666);
  margin-left: auto;
  transition: transform 0.2s ease;
}

.selection-sheet-button[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .selection-sheet-header {
    padding: 16px 20px;
  }

  .selection-sheet-title {
    font-size: 18px;
  }

  .selection-sheet-item {
    padding: 14px 20px;
    min-height: 52px;
  }

  .selection-sheet-footer {
    padding: 12px 20px;
  }

  .selection-sheet-done {
    padding: 16px;
  }
}

/* Dark mode support - using class-based selectors to match app's dark mode implementation */
:root[data-bar-mode='dark'] .selection-sheet,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet,
.mode-dark .selection-sheet {
  background: var(--surface, #1a1a1a) !important;
  color: var(--text, #fff) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-header,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-header,
.mode-dark .selection-sheet-header {
  border-bottom-color: var(--border, rgba(255, 255, 255, 0.1)) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-title,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-title,
.mode-dark .selection-sheet-title {
  color: var(--text, #fff) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-clear,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-clear,
.mode-dark .selection-sheet-clear {
  color: var(--accent, #c47e42) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-clear:hover,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-clear:hover,
.mode-dark .selection-sheet-clear:hover {
  background: var(--accent-soft, rgba(196, 126, 66, 0.2)) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-close,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-close,
.mode-dark .selection-sheet-close {
  color: var(--text-muted, #aaa) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-close:hover,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-close:hover,
.mode-dark .selection-sheet-close:hover {
  color: var(--text, #fff) !important;
  background: var(--accent-soft, rgba(196, 126, 66, 0.2)) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-item-label,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-item-label,
.mode-dark .selection-sheet-item-label {
  color: var(--text, #fff) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-item-description,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-item-description,
.mode-dark .selection-sheet-item-description {
  color: var(--text-muted, #aaa) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-footer,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-footer,
.mode-dark .selection-sheet-footer {
  border-top-color: var(--border, rgba(255, 255, 255, 0.1)) !important;
  background: var(--surface, #1a1a1a) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-button,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-button,
.mode-dark .selection-sheet-button {
  background: var(--surface, #1a1a1a) !important;
  color: var(--text, #fff) !important;
  border-color: var(--border, rgba(255, 255, 255, 0.2)) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-button:hover,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-button:hover,
.mode-dark .selection-sheet-button:hover {
  background: var(--accent-soft, rgba(196, 126, 66, 0.15)) !important;
  border-color: var(--accent, #c47e42) !important;
  color: var(--text, #fff) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-button--has-selection,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-button--has-selection,
.mode-dark .selection-sheet-button--has-selection {
  color: var(--text, #fff) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-button::after,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-button::after,
.mode-dark .selection-sheet-button::after {
  color: var(--text-muted, #aaa) !important;
}

:root[data-bar-mode='dark'] .selection-sheet-empty,
:root[data-ui-theme][data-bar-mode='dark'] .selection-sheet-empty,
.mode-dark .selection-sheet-empty {
  color: var(--text-muted, #aaa) !important;
}

