/* 
 * Main CSS File
 * Modern Japanese-inspired design system for enterprise SaaS
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Noto+Sans+Mono+JP&display=swap');

/* Import component styles */
@import './components.css';
@import './styles.css';

/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */

:root {
  /* Typography */
  --font-primary: 'Noto Sans JP', 'Inter', sans-serif;
  --font-mono: 'Noto Sans Mono JP', monospace;

  /* Spacing Scale */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */

  /* Animation */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Favorites */
  --favorite-color: #ef4444;  /* Red for favorited state */
  --favorite-color-hover: #dc2626;

  /* ==========================================================================
     Light Mode Theme Variables (Default)
     ========================================================================== */
  --theme-bg-primary: #F8FAFC;
  --theme-bg-secondary: #F1F5F9;
  --theme-bg-tertiary: #E2E8F0;
  --theme-surface: #FFFFFF;
  --theme-surface-alt: #F9FBFF;
  --theme-border: #E2E8F0;
  --theme-border-dark: #CBD5E1;
  --theme-text-primary: #1E293B;
  --theme-text-secondary: #475569;
  --theme-text-tertiary: #64748B;
  --theme-text-disabled: #94A3B8;
  --theme-text-on-light: #1E293B;
  --theme-accent: #57A0C5;
  --theme-accent-light: #6BB2D0;
  --theme-accent-dark: #4B8CB1;
  --theme-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --theme-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --theme-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --theme-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ==========================================================================
   Dark Mode Theme Variables
   ========================================================================== */
[data-theme="dark"] {
  --theme-bg-primary: #0F172A;
  --theme-bg-secondary: #1E293B;
  --theme-bg-tertiary: #334155;
  --theme-surface: #1E293B;
  --theme-surface-alt: #263548;
  --theme-border: #334155;
  --theme-border-dark: #475569;
  --theme-text-primary: #F1F5F9;
  --theme-text-secondary: #CBD5E1;
  --theme-text-tertiary: #94A3B8;
  --theme-text-disabled: #64748B;
  --theme-text-on-light: #0F172A;
  --theme-accent: #57A0C5;
  --theme-accent-light: #6BB2D0;
  --theme-accent-dark: #4B8CB1;
  --theme-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --theme-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --theme-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --theme-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

html {
  @apply antialiased;
  font-feature-settings: "palt";  /* Japanese text spacing */
}

body {
  @apply bg-background text-text-primary font-sans;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/* Headings */
h1, .h1 {
  @apply text-3xl md:text-4xl font-bold leading-tight tracking-tight;
}

h2, .h2 {
  @apply text-2xl md:text-3xl font-bold leading-tight;
}

h3, .h3 {
  @apply text-xl md:text-2xl font-semibold leading-snug;
}

h4, .h4 {
  @apply text-lg md:text-xl font-semibold leading-snug;
}

h5, .h5 {
  @apply text-base md:text-lg font-semibold leading-snug;
}

h6, .h6 {
  @apply text-sm md:text-base font-semibold leading-snug;
}

/* Body Text */
.text-body-large {
  @apply text-lg leading-relaxed;
}

.text-body {
  @apply text-base leading-relaxed;
}

.text-body-small {
  @apply text-sm leading-relaxed;
}

.text-caption {
  @apply text-xs leading-relaxed text-text-tertiary;
}

/* Japanese Text Optimization */
.ja-text {
  @apply tracking-wide;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Links & Interactive Elements
   ========================================================================== */

a {
  @apply text-primary hover:text-primary-700 transition-colors duration-200;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Focus Styles */
:focus-visible {
  @apply outline-none ring-2 ring-primary/20 ring-offset-2;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

/* Input Base */
.input-base {
  @apply w-full px-4 py-2.5 text-sm bg-surface border border-neutral-200 rounded-lg
         focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary
         transition-colors duration-200;
}

/* Input Variants */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  @apply input-base;
}

/* Input States */
.input-error {
  @apply border-danger-500 focus:ring-danger-500/20 focus:border-danger-500;
}

.input-success {
  @apply border-success-500 focus:ring-success-500/20 focus:border-success-500;
}

.input-disabled {
  @apply bg-neutral-50 text-text-disabled cursor-not-allowed;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Button Base */
.btn {
  @apply inline-flex items-center justify-center px-4 py-2.5 text-sm font-medium
         rounded-lg transition-all duration-200
         focus:outline-none focus:ring-2 focus:ring-offset-2
         disabled:opacity-50 disabled:cursor-not-allowed
         will-change-transform transform-gpu;
}

/* Button Variants */
.btn-primary {
  @apply btn bg-primary text-white hover:bg-primary-700
         focus:ring-primary/20 active:bg-primary-800;
}

.btn-secondary {
  @apply btn bg-white text-text-primary border border-neutral-200
         hover:bg-neutral-50 focus:ring-neutral-500/20
         active:bg-neutral-100;
}

.btn-danger {
  @apply btn bg-danger-500 text-white hover:bg-danger-600
         focus:ring-danger-500/20 active:bg-danger-700;
}

.btn-ghost {
  @apply btn text-text-primary hover:bg-neutral-100
         focus:ring-neutral-500/20 active:bg-neutral-200;
}

/* Button Sizes */
.btn-sm {
  @apply px-3 py-1.5 text-xs;
}

.btn-lg {
  @apply px-5 py-3 text-base;
}

/* Button with Icon */
.btn-icon {
  @apply p-2 rounded-lg;
}

/* ==========================================================================
   Cards & Containers
   ========================================================================== */

.card {
  @apply bg-surface rounded-lg border border-neutral-200 shadow-card
         transition-shadow duration-200 hover:shadow-card-hover;
}

.card-header {
  @apply p-4 border-b border-neutral-200;
}

.card-body {
  @apply p-4;
}

.card-footer {
  @apply p-4 border-t border-neutral-200;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Text */
.text-truncate {
  @apply overflow-hidden text-ellipsis whitespace-nowrap;
}

.text-balance {
  text-wrap: balance;
}

/* Accessibility */
.visually-hidden {
  @apply sr-only;
}

.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2;
}

/* Transitions */
.transition-transform {
  @apply transition-transform duration-200 will-change-transform;
}

.transition-opacity {
  @apply transition-opacity duration-200 will-change-opacity;
}

/* ==========================================================================
   Package Scrolling Utilities
   ========================================================================== */

/* Hide scrollbars completely */
.category-scroll-container {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
}

.category-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Scrollbar hide utility */
.scrollbar-hide {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Category wrapper */
.category-wrapper {
  position: relative;
}

/* Category scroll buttons */
.category-scroll-left,
.category-scroll-right {
  transition: all 0.2s ease;
  will-change: opacity, transform;
}

.category-scroll-left:hover:not(:disabled),
.category-scroll-right:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-scroll-left:active:not(:disabled),
.category-scroll-right:active:not(:disabled) {
  transform: translateY(-50%) scale(0.95);
}

/* Package card animations */
.package-card {
  transition: all 0.2s ease;
  will-change: transform, box-shadow;
}

.package-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  /* Hide scroll buttons on mobile */
  .category-scroll-left,
  .category-scroll-right,
  .scroll-button {
    display: none !important;
  }

  /* Convert horizontal scroll to 2-column grid on mobile */
  .package-scroll-container {
    overflow-x: visible !important;
    overflow: visible !important;
  }

  .package-scroll-container > .flex {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    padding-bottom: 0 !important;
  }

  .package-card {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    min-height: 300px !important;
    height: auto !important;
  }

  /* Adjust card content for mobile grid */
  .package-card .aspect-video {
    aspect-ratio: 4/3;
  }

  .package-card h3 {
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .package-card .text-xs {
    font-size: 0.65rem;
  }

  .package-card .text-sm {
    font-size: 0.75rem;
  }

  /* Skeleton loading - also use grid on mobile */
  .skeleton-category-scroll {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    overflow: visible !important;
  }

  .skeleton-package-card {
    min-width: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .package-scroll-container > .flex {
    gap: 8px !important;
  }

  .package-card h3 {
    font-size: 0.75rem;
  }

  .package-card .p-3 {
    padding: 8px !important;
  }

  .package-card button {
    padding: 6px 8px !important;
    font-size: 0.85rem !important;
  }
}

/* ==========================================================================
   Pagination Styles
   ========================================================================== */

#packages-pagination {
  background: linear-gradient(to top, theme('colors.background.alt'), theme('colors.surface'));
}

#packages-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#packages-pagination button:not(:disabled):hover {
  background-color: theme('colors.neutral.50');
}

/* Page number buttons */
#pagination-numbers button {
  min-width: 40px;
  font-weight: 500;
}

#pagination-numbers button:hover:not(.bg-primary) {
  background-color: theme('colors.neutral.50');
}

/* Mobile pagination */
@media (max-width: 640px) {
  #packages-pagination .sm\\:hidden button {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    @apply bg-white text-black;
  }
  
  .table-responsive {
    @apply overflow-visible;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
}

/* ==========================================================================
   Favorites Components
   ========================================================================== */

/* Favorite button styling */
.favorite-btn {
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.favorite-btn.favorited {
  background: rgba(255, 255, 255, 0.95);
}

.favorite-btn.favorited i {
  color: var(--favorite-color) !important;
}

.favorite-btn.processing {
  opacity: 0.6;
  pointer-events: none;
}

/* Favorite toast notification */
#favorite-toast {
  backdrop-filter: blur(8px);
}

/* Heart animation */
@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.favorite-btn i.animate-pulse {
  animation: heartBeat 0.6s ease-in-out;
}

/* Tab fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

/* ==========================================================================
   PAGE LAYOUT SYSTEM - Universal Component Structure
   ========================================================================== */

/* Page Container - Used by ALL tab components for consistency */
.page-container {
  padding: 2rem 1.5rem;
  width: 100%;
  min-height: calc(100vh - 3.5rem);
}

/* Page Container Fluid - For components that need full width */
.page-container-fluid {
  padding: 0;
  width: 100%;
  min-height: calc(100vh - 3.5rem);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .page-container {
    padding: 1rem;
    min-height: calc(100vh - 3.5rem);
  }
}

/* ==========================================================================
   PAGE HEADER - Consistent header structure for all components
   ========================================================================== */

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  /* Color is inherited from child span elements or defaults to text-primary */
}

.page-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .page-title {
    font-size: 1.5rem;
  }
  
  .page-subtitle {
    font-size: 0.8125rem;
  }
}

/* ==========================================================================
   CONTENT SECTIONS - Spacing and organization
   ========================================================================== */

.content-section {
  margin-bottom: 2rem;
}

.content-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #374151;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .content-section {
    margin-bottom: 1.5rem;
  }
  
  .section-title {
    font-size: 1.125rem;
  }
}

/* ==========================================================================
   FILTER PANEL - For search and filter components
   ========================================================================== */

.filter-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .filter-panel {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
}

/* ==========================================================================
   RESULTS PANEL - For displaying data tables and results
   ========================================================================== */

.results-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.results-count {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .results-panel {
    padding: 1rem;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   DARK MODE STYLES
   ========================================================================== */

/* Dark mode transition for smooth theme switching */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] body {
  background-color: var(--theme-bg-primary) !important;
  color: var(--theme-text-primary) !important;
}

/* Header in dark mode */
[data-theme="dark"] #header {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] #header .text-gray-800,
[data-theme="dark"] #header .text-gray-600 {
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] #header button:hover,
[data-theme="dark"] #header .hover\\:bg-gray-100:hover {
  background-color: var(--theme-bg-tertiary) !important;
}

[data-theme="dark"] #header .bg-gray-100 {
  background-color: var(--theme-bg-tertiary) !important;
}

/* Sidebar in dark mode */
[data-theme="dark"] #sidebar,
[data-theme="dark"] aside {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] #sidebar a,
[data-theme="dark"] #sidebar button {
  color: var(--theme-text-secondary) !important;
}

[data-theme="dark"] #sidebar a:hover,
[data-theme="dark"] #sidebar button:hover {
  background-color: var(--theme-bg-tertiary) !important;
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] #sidebar a.active,
[data-theme="dark"] #sidebar button.active {
  background-color: rgba(87, 160, 197, 0.15) !important;
  color: var(--theme-accent) !important;
}

/* Main content area */
[data-theme="dark"] main,
[data-theme="dark"] .main-content,
[data-theme="dark"] #main-content {
  background-color: var(--theme-bg-primary) !important;
}

/* Cards and panels */
[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] .filter-panel,
[data-theme="dark"] .results-panel {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow) !important;
}

[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
  border-color: var(--theme-border) !important;
}

/* Page components */
[data-theme="dark"] .page-header {
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] .page-title {
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .page-subtitle,
[data-theme="dark"] .section-title {
  color: var(--theme-text-secondary) !important;
}

/* Form inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .input-base {
  background-color: var(--theme-bg-secondary) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--theme-text-disabled) !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--theme-accent) !important;
  box-shadow: 0 0 0 3px rgba(87, 160, 197, 0.2) !important;
}

/* Buttons */
[data-theme="dark"] .btn-secondary {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .btn-secondary:hover {
  background-color: var(--theme-bg-tertiary) !important;
}

[data-theme="dark"] .btn-ghost:hover {
  background-color: var(--theme-bg-tertiary) !important;
}

/* Tables */
[data-theme="dark"] table {
  background-color: var(--theme-surface) !important;
}

[data-theme="dark"] th {
  background-color: var(--theme-bg-secondary) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] td {
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] tr:hover {
  background-color: var(--theme-bg-secondary) !important;
}

[data-theme="dark"] tbody tr:nth-child(even) {
  background-color: var(--theme-bg-secondary) !important;
}

/* Dropdowns and menus */
[data-theme="dark"] #bucket-dropdown,
[data-theme="dark"] #notification-dropdown,
[data-theme="dark"] #user-menu,
[data-theme="dark"] .dropdown-menu {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
  box-shadow: var(--theme-shadow-lg) !important;
}

[data-theme="dark"] #bucket-dropdown .border-border,
[data-theme="dark"] #notification-dropdown .border-border,
[data-theme="dark"] #user-menu .border-border {
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] #user-menu a,
[data-theme="dark"] #user-menu button,
[data-theme="dark"] .dropdown-menu a,
[data-theme="dark"] .dropdown-menu button {
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] #user-menu a:hover,
[data-theme="dark"] #user-menu button:hover,
[data-theme="dark"] .dropdown-menu a:hover,
[data-theme="dark"] .dropdown-menu button:hover {
  background-color: var(--theme-bg-tertiary) !important;
}

/* Text colors */
[data-theme="dark"] .text-text-primary,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700 {
  color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .text-text-secondary,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500 {
  color: var(--theme-text-secondary) !important;
}

[data-theme="dark"] .text-text-tertiary,
[data-theme="dark"] .text-gray-400 {
  color: var(--theme-text-tertiary) !important;
}

/* Background colors */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-surface {
  background-color: var(--theme-surface) !important;
}

[data-theme="dark"] .bg-background,
[data-theme="dark"] .bg-gray-50 {
  background-color: var(--theme-bg-primary) !important;
}

[data-theme="dark"] .bg-background-alt,
[data-theme="dark"] .bg-gray-100 {
  background-color: var(--theme-bg-secondary) !important;
}

[data-theme="dark"] .bg-background-alt-strong {
  background-color: #162235 !important;
}

[data-theme="dark"] .bg-background-alt-strong-90 {
  background-color: rgba(22, 34, 53, 0.9) !important;
}

[data-theme="dark"] .hover\:bg-background-alt:hover {
  background-color: #233149 !important;
}

[data-theme="dark"] .bg-neutral-50,
[data-theme="dark"] .bg-neutral-100 {
  background-color: var(--theme-bg-secondary) !important;
}

/* Border colors */
[data-theme="dark"] .border-border,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-neutral-200 {
  border-color: var(--theme-border) !important;
}

/* Scrollbar dark mode */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--theme-bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--theme-border-dark);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--theme-text-disabled);
}

/* Search results and loading states */
[data-theme="dark"] .search-results-container,
[data-theme="dark"] #search-results {
  background-color: var(--theme-surface) !important;
}

[data-theme="dark"] .loading-overlay {
  background-color: rgba(15, 23, 42, 0.8) !important;
}

[data-theme="dark"] #map-loading {
  background-color: var(--theme-bg-primary) !important;
  color: var(--theme-text-primary) !important;
}

/* Modals - overlay should be semi-transparent, not solid */
[data-theme="dark"] .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(2px);
}

/* Modal content panels (not the overlay) */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-panel,
[data-theme="dark"] [role="dialog"] > div > div.relative {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
}

/* Package cards */
[data-theme="dark"] .package-card {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] .package-card:hover {
  box-shadow: var(--theme-shadow-lg) !important;
}

/* Badges and tags */
[data-theme="dark"] .badge,
[data-theme="dark"] .tag {
  background-color: var(--theme-bg-tertiary) !important;
  color: var(--theme-text-primary) !important;
}

/* Tooltips */
[data-theme="dark"] [data-tooltip]::after,
[data-theme="dark"] .tooltip {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

/* Empty state */
[data-theme="dark"] .empty-state-overlay {
  background-color: rgba(15, 23, 42, 0.95) !important;
}

/* Results count display */
[data-theme="dark"] .results-count {
  color: var(--theme-text-secondary) !important;
}

/* Filter group labels */
[data-theme="dark"] .filter-group label {
  color: var(--theme-text-secondary) !important;
}

/* Hover states for interactive elements */
[data-theme="dark"] .hover\\:bg-gray-50:hover,
[data-theme="dark"] .hover\\:bg-neutral-50:hover {
  background-color: var(--theme-bg-secondary) !important;
}

/* Dark mode toggle button styling */
.theme-toggle-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.3s ease;
  cursor: pointer;
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
}

.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.theme-toggle-btn .sun-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.theme-toggle-btn .moon-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* Pagination dark mode */
[data-theme="dark"] #packages-pagination {
  background: linear-gradient(to top, var(--theme-bg-secondary), var(--theme-surface)) !important;
}

[data-theme="dark"] #pagination-numbers button:hover:not(.bg-primary) {
  background-color: var(--theme-bg-tertiary) !important;
}

/* Mobile navigation dark mode */
[data-theme="dark"] #mobile-nav {
  background-color: var(--theme-bg-primary) !important;
}

/* Checkbox and radio dark mode */
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
  background-color: var(--theme-bg-secondary) !important;
  border-color: var(--theme-border) !important;
}

[data-theme="dark"] input[type="checkbox"]:checked,
[data-theme="dark"] input[type="radio"]:checked {
  background-color: var(--theme-accent) !important;
  border-color: var(--theme-accent) !important;
}
