/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 */

@tailwind base;
@tailwind components;
@tailwind utilities;

/* Additional utility classes for colors that might be missing */
.text-green-400 { color: #4ade80; }
.text-red-400 { color: #f87171; }
.bg-green-600 { background-color: #059669; }
.bg-red-600 { background-color: #dc2626; }

/* Collapsible content styling */
.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

/* Custom range slider styling for volume control */
.slider-orange {
  appearance: none;
  -webkit-appearance: none;
  background: #374151;
  outline: none;
  border-radius: 5px;
  height: 8px;
}

.slider-orange::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ea580c;
  cursor: pointer;
  border: 2px solid #fed7aa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider-orange::-webkit-slider-thumb:hover {
  background: #f97316;
  transform: scale(1.1);
}

.slider-orange::-moz-range-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ea580c;
  cursor: pointer;
  border: 2px solid #fed7aa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider-orange::-moz-range-thumb:hover {
  background: #f97316;
  transform: scale(1.1);
}

.slider-orange::-moz-range-track {
  background: #374151;
  height: 8px;
  border-radius: 5px;
}

.slider-orange::-moz-range-progress {
  background: #ea580c;
  height: 8px;
  border-radius: 5px;
}

/* Custom styles for Darkest Dungeon Soundboard */

/* Base dark theme styling - must come after Tailwind base */
html {
  background: linear-gradient(135deg, #111827 0%, #000000 100%);
  min-height: 100%;
}

body {
  background: linear-gradient(135deg, #111827 0%, #000000 100%);
  color: #fed7aa;
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* Card components */
.dd-card-base {
  background: rgba(31, 41, 55, 0.8);
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
}

.dd-card-hover {
  transition: all 0.2s ease;
}

.dd-card-hover:hover {
  background: rgba(55, 65, 81, 0.9);
  border-color: #ea580c;
  box-shadow: 0 0 20px rgba(234, 88, 12, 0.3);
  transform: scale(1.05);
}

.dd-card-interactive {
  cursor: pointer;
}

/* Button components */
.dd-btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.dd-btn-primary {
  background: linear-gradient(135deg, #ea580c, #f97316) !important;
  color: white !important;
  border-color: #ea580c !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}

.dd-btn-primary:hover {
  background: linear-gradient(135deg, #f97316, #fb923c);
  box-shadow: 0 0 40px rgba(234, 88, 12, 0.4);
  transform: translateY(-1px);
}

.dd-btn-secondary {
  background: #4b5563 !important;
  color: white !important;
  border-color: #6b7280 !important;
}

.dd-btn-secondary:hover {
  background: #6b7280;
}

.dd-btn-success {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: white !important;
  border-color: #059669 !important;
}

.dd-btn-success:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.dd-btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  color: white !important;
  border-color: #dc2626 !important;
}

.dd-btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #f87171);
}

.dd-btn-warning {
  background: linear-gradient(135deg, #eab308, #facc15) !important;
  color: white !important;
  border-color: #eab308 !important;
}

.dd-btn-warning:hover {
  background: linear-gradient(135deg, #facc15, #fde047);
}

.dd-btn-accent {
  background: linear-gradient(135deg, #9333ea, #a855f7) !important;
  color: white !important;
  border-color: #9333ea !important;
}

.dd-btn-accent:hover {
  background: linear-gradient(135deg, #a855f7, #c084fc);
}

.dd-btn-camping {
  background: linear-gradient(135deg, #1e40af, #3b82f6) !important;
  color: white !important;
  border-color: #1e40af !important;
}

.dd-btn-camping:hover {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

/* Official Darkest Dungeon Region Colors */
.dd-btn-ruins {
  background: linear-gradient(135deg, #8A8B8D, #9FA0A2) !important;
  color: white !important;
  border-color: #8A8B8D !important;
}

.dd-btn-ruins:hover {
  background: linear-gradient(135deg, #9FA0A2, #B4B5B7);
}

.dd-btn-cove {
  background: linear-gradient(135deg, #006CA9, #0080C7) !important;
  color: white !important;
  border-color: #006CA9 !important;
}

.dd-btn-cove:hover {
  background: linear-gradient(135deg, #0080C7, #0095E6);
}

.dd-btn-courtyard {
  background: linear-gradient(135deg, #910913, #A50F1C) !important;
  color: white !important;
  border-color: #910913 !important;
}

.dd-btn-courtyard:hover {
  background: linear-gradient(135deg, #A50F1C, #BA1B2A);
}

.dd-btn-warrens {
  background: linear-gradient(135deg, #B27F44, #C68F4F) !important;
  color: white !important;
  border-color: #B27F44 !important;
}

.dd-btn-warrens:hover {
  background: linear-gradient(135deg, #C68F4F, #DB9F5A);
}

.dd-btn-weald {
  background: linear-gradient(135deg, #A09935, #B3A63F) !important;
  color: white !important;
  border-color: #A09935 !important;
}

.dd-btn-weald:hover {
  background: linear-gradient(135deg, #B3A63F, #C6B948);
}

.dd-btn-farmstead {
  background: linear-gradient(135deg, #04B89C, #05C9AC) !important;
  color: white !important;
  border-color: #04B89C !important;
}

.dd-btn-farmstead:hover {
  background: linear-gradient(135deg, #05C9AC, #06DABC);
}

/* Typography */
.dd-heading-primary {
  font-size: 1.75rem;
  font-weight: bold;
  color: #fdba74;
}

@media (min-width: 640px) {
  .dd-heading-primary {
    font-size: 2.25rem;
  }
}

@media (min-width: 768px) {
  .dd-heading-primary {
    font-size: 3rem;
  }
}

.dd-heading-secondary {
  font-size: 1.25rem;
  font-weight: bold;
  color: #fdba74;
}

@media (min-width: 768px) {
  .dd-heading-secondary {
    font-size: 1.5rem;
  }
}

.dd-text-muted {
  color: #9ca3af;
}

.dd-text-accent {
  color: #fed7aa;
}

/* Quote display */
.dd-quote-card {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid #374151;
  border-left: 4px solid #ea580c;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dd-quote-text {
  color: #fed7aa;
  font-style: italic;
  font-size: 1.125rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}

/* Category grid */
.dd-category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .dd-category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dd-category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .dd-category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.dd-category-card {
  background: rgba(31, 41, 55, 0.8);
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dd-category-card:hover {
  background: rgba(55, 65, 81, 0.9);
  border-color: #ea580c;
  box-shadow: 0 0 20px rgba(234, 88, 12, 0.3);
  transform: scale(1.05);
}

.dd-category-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.dd-category-icon {
  color: #fb923c;
  font-size: 1.25rem;
  margin-right: 0.75rem;
  transition: color 0.2s ease;
}

.dd-category-card:hover .dd-category-icon {
  color: #fdba74;
}

.dd-category-title {
  color: #fdba74;
  font-weight: bold;
  font-size: 1.125rem;
  transition: color 0.2s ease;
}

.dd-category-card:hover .dd-category-title {
  color: #fed7aa;
}

.dd-category-count {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Progress elements */
.dd-progress-bar {
  width: 100%;
  height: 0.5rem;
  background: #374151;
  border-radius: 9999px;
}

.dd-progress-fill {
  height: 0.5rem;
  background: linear-gradient(to right, #ea580c, #fb923c);
  border-radius: 9999px;
  transition: all 0.3s ease;
}

.dd-progress-container {
  position: relative;
  cursor: pointer;
}

.dd-progress-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  background: #ea580c;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 0 10px rgba(234, 88, 12, 0.5);
  left: calc(var(--progress, 0%) - 0.5rem);
}

.dd-progress-container:hover .dd-progress-handle {
  opacity: 1;
}


/* Loading states */
.dd-loading {
  position: relative;
  overflow: hidden;
}

.dd-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(234, 88, 12, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Generic range slider styling - kept for potential future use */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  background: #374151;
  border-radius: 5px;
  outline: none;
  height: 8px;
}

input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ea580c;
  cursor: pointer;
  border: 2px solid #1f2937;
  transition: all 0.2s ease;
}

input[type="range"].slider::-webkit-slider-thumb:hover {
  background: #fb7c3c;
  transform: scale(1.1);
}

input[type="range"].slider::-moz-range-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ea580c;
  cursor: pointer;
  border: 2px solid #1f2937;
  transition: all 0.2s ease;
}

input[type="range"].slider::-moz-range-thumb:hover {
  background: #fb7c3c;
  transform: scale(1.1);
}

input[type="range"].slider::-moz-range-track {
  background: #374151;
  height: 8px;
  border-radius: 5px;
}

input[type="range"].slider::-moz-range-progress {
  background: #ea580c;
  height: 8px;
  border-radius: 5px;
}

/* Smooth transitions for all interactive elements */
button, select, input {
  transition: all 0.2s ease;
}

/* Focus states for accessibility */
button:focus,
select:focus,
input:focus {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

/* Loading animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fa-spin {
  animation: spin 1s linear infinite;
}

/* Low bandwidth mode adjustments */
.low-bandwidth img,
.low-bandwidth video {
  filter: grayscale(20%);
}

.low-bandwidth .transition-all {
  transition: none !important;
}

/* Mobile touch feedback */
@media (hover: none) {
  button:hover {
    transform: none;
  }
  
  button:active {
    transform: scale(0.98);
  }
}

/* Pulse animation for active buttons */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.animate-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #374151;
}

::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Ensure full height on mobile */
html, body {
  height: 100%;
  overflow-x: hidden;
}

/* Prevent text selection on UI elements */
button, .no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Mobile optimizations */
.touch-feedback {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(234, 88, 12, 0.3);
}

/* Better scrolling on mobile */
* {
  -webkit-overflow-scrolling: touch;
}

/* Improved focus states for accessibility */
@media (prefers-reduced-motion: no-preference) {
  button:focus,
  select:focus,
  input:focus {
    transition: outline-offset 0.15s ease;
    outline-offset: 4px;
  }
}

/* Audio loading states */
.audio-loading {
  position: relative;
  overflow: hidden;
}

.audio-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(234, 88, 12, 0.3), transparent);
  animation: audio-loading 1.5s infinite;
}

@keyframes audio-loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Notification animations */
.notification-enter {
  animation: slideInRight 0.3s ease-out;
}

.notification-exit {
  animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

/* Animation classes */
.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

.animate-bounce-subtle {
  animation: bounceSubtle 0.6s ease-in-out;
}


@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideUp {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes bounceSubtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Hold button visual feedback */
.hold-active {
  transform: scale(1.05) !important;
  box-shadow: 0 0 20px rgba(234, 88, 12, 0.6) !important;
}

/* Category popup styling */
.category-popup {
  animation: popupSlideUp 0.2s ease-out;
  z-index: 1000;
}

.category-popup .category-option {
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.category-popup .category-option:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* Circular category popup styling */
.category-popup-circular {
  animation: circularPopupAppear 0.3s ease-out;
  z-index: 1000;
  pointer-events: none; /* Allow clicks to pass through background */
}

.category-popup-circular .circular-popup-background {
  pointer-events: auto; /* Re-enable clicks on the circle */
}

.category-popup-circular .category-option-circular {
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.category-popup-circular .category-option-circular:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Active state for touch devices */
.category-popup-circular .category-option-circular:active {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes popupSlideUp {
  0% { 
    opacity: 0; 
    transform: translateY(10px) scale(0.95); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

@keyframes circularPopupAppear {
  0% { 
    opacity: 0; 
    transform: scale(0.3) rotate(-10deg); 
  }
  60% { 
    opacity: 1; 
    transform: scale(1.05) rotate(2deg); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1) rotate(0deg); 
  }
}

/* Visual feedback for categories */
.category-option.hover-highlight {
  background: rgba(234, 88, 12, 0.8) !important;
  border-color: #fb923c !important;
  transform: scale(1.1);
}

/* Prevent text selection during hold */
.no-select-on-hold {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Enhanced button states for hold functionality */
.dd-btn-success.hold-active {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.6) !important;
}

.dd-btn-danger.hold-active {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.6) !important;
}

/* Mobile touch feedback improvements */
@media (hover: none) and (pointer: coarse) {
  .category-popup {
    /* Larger touch targets and better spacing on mobile */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  
  .category-popup .category-option {
    min-height: 48px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    /* Improve touch responsiveness */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(234, 88, 12, 0.3);
  }
  
  /* Larger touch area for category options */
  .category-popup .category-option::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    z-index: -1;
  }
  
  /* Better visual feedback on touch */
  .category-popup .category-option:active {
    transform: scale(0.95);
    background: rgba(234, 88, 12, 0.8) !important;
  }
}

/* Performance optimization modes */
.low-battery-mode {
  /* Reduce animations and effects to save battery */
}

.low-battery-mode * {
  animation-duration: 0.1s !important;
  transition-duration: 0.1s !important;
}

.low-battery-mode .dd-audio-wave {
  display: none !important;
}

.slow-connection {
  /* Reduce visual complexity on slow connections */
}

.slow-connection .dd-card-hover:hover {
  transform: none !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

.offline-mode {
  /* Visual indicators for offline state */
}

.offline-mode::before {
  content: 'OFFLINE';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #dc2626;
  color: white;
  text-align: center;
  padding: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 9999;
}

/* Viewport height fix for mobile browsers */
:root {
  --vh: 1vh;
}

.min-h-screen {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

/* Better touch targets */
@media (hover: none) {
  button, [role="button"], .dd-btn-base {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Prevent text selection during touch interactions */
.category-popup,
.hold-active {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Enhanced touch feedback for buttons */
@media (hover: none) and (pointer: coarse) {
  .dd-btn-success:active,
  .dd-btn-danger:active {
    transform: scale(0.98);
  }
  
  .dd-btn-success.hold-active,
  .dd-btn-danger.hold-active {
    transform: scale(1.02) !important;
  }
}