/**
 * Bottom Sheet Modal Styles
 * Responsive styles for mobile, tablet, and desktop
 */

/* =====================================================
   BACKDROP
   ===================================================== */
.bs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
  z-index: 10100;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.bs-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* =====================================================
   MODAL CONTAINER
   ===================================================== */
.bs-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg, #ffffff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.25);
  transform: translateY(100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10101;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.bs-modal.open {
  transform: translateY(0);
}

/* =====================================================
   HANDLE (GRABBER)
   ===================================================== */
.bs-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.bs-handle:active {
  cursor: grabbing;
}

.bs-grabber {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .bs-grabber {
  background: rgba(255, 255, 255, 0.3);
}

/* =====================================================
   CONTENT CONTAINER
   ===================================================== */
.bs-container {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 1rem 1.5rem;
}

.bs-share-content {
  max-width: 640px;
  margin: 0 auto;
}

.bs-share-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text, #000);
}

.bs-location-preview {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 0.5rem 0 1rem;
  color: var(--text, #000);
}

.bs-url-preview {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  margin: 0 0 1rem;
  opacity: 0.75;
}

/* =====================================================
   SHARE OPTIONS CONTAINER
   ===================================================== */
.bs-share-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1rem;
}

/* =====================================================
   MOBILE: Compact 1-line buttons
   ===================================================== */
.bs-share-options.mobile .bs-share-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-share-options.mobile .bs-share-opt:active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.06);
}

.bs-share-options.mobile .bs-opt-icon {
  font-size: 1.5rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.bs-share-options.mobile .bs-opt-label {
  flex: 1;
}

/* Primary button in mobile */
.bs-share-options.mobile .bs-opt-primary {
  background: var(--accent, #007aff);
  color: white;
  border-color: var(--accent, #007aff);
  font-weight: 600;
}

.bs-share-options.mobile .bs-opt-primary:active {
  background: var(--accent-dark, #0051d5);
}

/* =====================================================
   TABLET: Hybrid layout (spacious 1-line)
   ===================================================== */
.bs-share-options.tablet .bs-share-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-share-options.tablet .bs-share-opt:hover {
  background: rgba(0, 0, 0, 0.04);
}

.bs-share-options.tablet .bs-share-opt:active {
  transform: scale(0.98);
}

.bs-share-options.tablet .bs-opt-icon {
  font-size: 1.6rem;
  width: 34px;
  text-align: center;
  flex-shrink: 0;
}

.bs-share-options.tablet .bs-opt-label {
  flex: 1;
}

/* Primary button in tablet */
.bs-share-options.tablet .bs-opt-primary {
  background: var(--accent, #007aff);
  color: white;
  border-color: var(--accent, #007aff);
  font-weight: 600;
}

.bs-share-options.tablet .bs-opt-primary:hover {
  background: var(--accent-dark, #0051d5);
}

/* =====================================================
   DESKTOP: 2-line buttons with descriptions
   ===================================================== */
.bs-share-options.desktop .bs-share-opt {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-share-options.desktop .bs-share-opt:hover {
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bs-share-options.desktop .bs-share-opt:active {
  transform: scale(0.99);
}

.bs-share-options.desktop .bs-opt-icon {
  font-size: 1.8rem;
  width: 36px;
  text-align: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.bs-share-options.desktop .bs-opt-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bs-share-options.desktop .bs-opt-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #000);
}

.bs-share-options.desktop .bs-opt-desc {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  opacity: 0.75;
}

/* Primary button in desktop */
.bs-share-options.desktop .bs-opt-primary {
  background: linear-gradient(135deg, var(--accent, #007aff) 0%, var(--accent-dark, #0051d5) 100%);
  border-color: var(--accent, #007aff);
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.3);
}

.bs-share-options.desktop .bs-opt-primary .bs-opt-label,
.bs-share-options.desktop .bs-opt-primary .bs-opt-desc {
  color: white;
}

.bs-share-options.desktop .bs-opt-primary:hover {
  background: linear-gradient(135deg, var(--accent-dark, #0051d5) 0%, var(--accent, #007aff) 100%);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
}

/* =====================================================
   DARK MODE
   ===================================================== */
html[data-theme="dark"] .bs-modal {
  background: var(--bg, #1c1c1e);
  box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .bs-share-content h3,
html[data-theme="dark"] .bs-location-preview {
  color: var(--text, #ffffff);
}

html[data-theme="dark"] .bs-url-preview {
  color: var(--text-secondary, #999);
}

html[data-theme="dark"] .bs-share-opt {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text, #ffffff);
}

html[data-theme="dark"] .bs-share-options.mobile .bs-share-opt:active,
html[data-theme="dark"] .bs-share-options.tablet .bs-share-opt:active {
  background: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .bs-share-options.desktop .bs-share-opt:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .bs-opt-desc {
  color: var(--text-secondary, #999);
}

/* Dark mode primary buttons keep their color */
html[data-theme="dark"] .bs-opt-primary {
  background: var(--accent, #0a84ff) !important;
  border-color: var(--accent, #0a84ff) !important;
}

html[data-theme="dark"] .bs-share-options.desktop .bs-opt-primary {
  background: linear-gradient(135deg, var(--accent, #0a84ff) 0%, #0066cc 100%) !important;
  box-shadow: 0 2px 12px rgba(10, 132, 255, 0.4);
}

html[data-theme="dark"] .bs-share-options.desktop .bs-opt-primary:hover {
  background: linear-gradient(135deg, #0066cc 0%, var(--accent, #0a84ff) 100%) !important;
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.5);
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */
.bs-share-opt:focus {
  outline: 2px solid var(--accent, #007aff);
  outline-offset: 2px;
}

.bs-share-opt:focus:not(:focus-visible) {
  outline: none;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */
@media (max-width: 480px) {
  .bs-modal {
    border-radius: 20px 20px 0 0;
  }
  
  .bs-share-content h3 {
    font-size: 1.15rem;
  }
  
  .bs-share-options.mobile .bs-share-opt {
    padding: 11px 14px;
    font-size: 0.95rem;
  }
}

@media (min-width: 768px) {
  .bs-modal {
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    max-width: 600px;
    border-radius: 16px;
    bottom: 20px;
  }
  
  .bs-modal.open {
    transform: translateX(-50%) translateY(0);
  }
}

@media (min-width: 1024px) {
  .bs-modal {
    max-width: 640px;
  }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes bs-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes bs-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .bs-modal,
  .bs-backdrop,
  .bs-share-opt {
    transition-duration: 0.01ms !important;
  }
}

/* =====================================================
   MENU PRESET STYLES
   ===================================================== */

/* Menu content container */
.bs-menu-content {
  max-width: 640px;
  margin: 0 auto;
}

.bs-menu-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--text, #000);
  text-align: center;
}

/* Menu options container */
.bs-menu-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1rem;
}

/* =====================================================
   MOBILE: Compact menu items
   ===================================================== */
.bs-menu-options.mobile .bs-menu-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-menu-options.mobile .bs-menu-opt:active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.06);
}

.bs-menu-options.mobile .bs-menu-icon {
  font-size: 1.4rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.bs-menu-options.mobile .bs-menu-label {
  flex: 1;
}

/* =====================================================
   TABLET: Spacious menu items
   ===================================================== */
.bs-menu-options.tablet .bs-menu-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-menu-options.tablet .bs-menu-opt:hover {
  background: rgba(0, 0, 0, 0.04);
}

.bs-menu-options.tablet .bs-menu-opt:active {
  transform: scale(0.98);
}

.bs-menu-options.tablet .bs-menu-icon {
  font-size: 1.5rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.bs-menu-options.tablet .bs-menu-label {
  flex: 1;
}

/* =====================================================
   DESKTOP: 2-line menu items with descriptions
   ===================================================== */
.bs-menu-options.desktop .bs-menu-opt {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  color: var(--text, #000);
  width: 100%;
  box-sizing: border-box;
}

.bs-menu-options.desktop .bs-menu-opt:hover {
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bs-menu-options.desktop .bs-menu-opt:active {
  transform: scale(0.99);
}

.bs-menu-options.desktop .bs-menu-icon {
  font-size: 1.6rem;
  width: 32px;
  text-align: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.bs-menu-options.desktop .bs-menu-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bs-menu-options.desktop .bs-menu-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #000);
}

.bs-menu-options.desktop .bs-menu-desc {
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  opacity: 0.75;
}

/* Menu footer (version info) */
.bs-menu-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary, #666);
  opacity: 0.7;
}

/* =====================================================
   DARK MODE - MENU
   ===================================================== */
html[data-theme="dark"] .bs-menu-content h3 {
  color: var(--text, #ffffff);
}

html[data-theme="dark"] .bs-menu-opt {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text, #ffffff);
}

html[data-theme="dark"] .bs-menu-options.mobile .bs-menu-opt:active,
html[data-theme="dark"] .bs-menu-options.tablet .bs-menu-opt:active {
  background: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .bs-menu-options.desktop .bs-menu-opt:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .bs-menu-desc {
  color: var(--text-secondary, #999);
}


html[data-theme="dark"] .bs-menu-footer {
  border-top-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, #999);
}

/* =====================================================
   MENU ACCESSIBILITY
   ===================================================== */
.bs-menu-opt:focus {
  outline: 2px solid var(--accent, #007aff);
  outline-offset: 2px;
}

.bs-menu-opt:focus:not(:focus-visible) {
  outline: none;
}

/* =====================================================
   GENERIC CONTENT STYLES (About, Coffee, Privacy)
   ===================================================== */
.bs-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 1rem;
}

.bs-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text, #000);
}

.bs-content p {
  line-height: 1.6;
  color: var(--text, #000);
}

.bs-content a {
  color: var(--accent, #007aff);
  text-decoration: none;
  font-weight: 500;
}

.bs-content a:hover {
  text-decoration: underline;
}

.bs-content ul {
  line-height: 1.6;
  color: var(--text, #000);
}

.bs-scrollable {
  overflow-y: auto;
  max-height: calc(90vh - 100px);
  -webkit-overflow-scrolling: touch;
}

html[data-theme="dark"] .bs-content h3,
html[data-theme="dark"] .bs-content p,
html[data-theme="dark"] .bs-content ul {
  color: var(--text, #fff);
}

/* =====================================================
   SETTINGS BOTTOM SHEET STYLES
   ===================================================== */
.bs-settings-group {
  margin-bottom: 1.5rem;
}

.bs-settings-group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
  margin: 0 0 0.75rem 0;
  color: var(--text, #000);
}

/* Segmented control for theme/nav */
.bs-segmented {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.bs-seg-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.bs-seg-btn.active {
  background: var(--surface, #fff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.75);
  font-weight: 600;
}

.bs-seg-btn:not(.active):hover {
  background: rgba(0, 0, 0, 0.03);
}

/* Settings button (language, advanced) */
.bs-settings-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text, #000);
  cursor: pointer;
  transition: all 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.bs-settings-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.bs-settings-btn:active {
  transform: scale(0.98);
}

/* Dark mode for settings */
html[data-theme="dark"] .bs-settings-group h3 {
  color: var(--text, #fff);
}

html[data-theme="dark"] .bs-segmented {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .bs-seg-btn {
  color: rgba(255, 255, 255, 0.6);
}

html[data-theme="dark"] .bs-seg-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
}

html[data-theme="dark"] .bs-seg-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .bs-settings-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
}

html[data-theme="dark"] .bs-settings-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Settings row (for permissions, updates) */
.bs-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface, #f5f5f5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  margin-bottom: 12px;
}

.bs-settings-sm-btn {
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text, #000);
  cursor: pointer;
  transition: all 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.bs-settings-sm-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.bs-settings-sm-btn:active {
  transform: scale(0.96);
}

/* Data buttons container */
.bs-data-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bs-data-buttons .bs-settings-sm-btn {
  flex: 1;
  min-width: 90px;
}

.bs-settings-btn.bs-danger,
.bs-settings-sm-btn.bs-danger {
  color: #dc3545;
  border-color: rgba(220, 53, 69, 0.3);
}

.bs-settings-sm-btn.bs-danger:hover {
  background: rgba(220, 53, 69, 0.08);
  border-color: rgba(220, 53, 69, 0.4);
}

html[data-theme="dark"] .bs-settings-row {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .bs-settings-sm-btn {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text, #fff);
}

html[data-theme="dark"] .bs-settings-sm-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .bs-settings-btn.bs-danger,
html[data-theme="dark"] .bs-settings-sm-btn.bs-danger {
  color: #ff6b7a;
  border-color: rgba(255, 107, 122, 0.3);
}

html[data-theme="dark"] .bs-settings-sm-btn.bs-danger:hover {
  background: rgba(255, 107, 122, 0.12);
  border-color: rgba(255, 107, 122, 0.4);
}

/* =====================================================
   SETTINGS VIEW TRANSITIONS (fade + slide)
   ===================================================== */
.bs-settings-view {
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bs-settings-view.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Position views absolutely to overlap during transition */
.bs-content.bs-scrollable {
  position: relative;
  min-height: 400px;
}

.bs-settings-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

/* When transitioning out, slide to the left */
.bs-settings-view:not(.active) {
  transform: translateX(-30px);
}


