/**
 * InstaParadise Storage Module Styles - FEAT-007
 * Favorites, Recent Searches, Settings Panel, Theme Toggle
 */

/* ============================================
   FAVORITES SECTION
   ============================================ */
.favorites-section,
.recently-viewed-section {
  padding: 4rem 5%;
  background: linear-gradient(135deg, var(--bg) 0%, #f0ebe0 100%);
}

.favorites-section h2,
.recently-viewed-section h2 {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.favorites-section h2::before {
  content: '❤️';
}

.recently-viewed-section h2::before {
  content: '👁️';
}

.favorites-grid,
.viewed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.favorite-card {
  position: relative;
}

.favorite-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.favorite-btn svg {
  width: 20px;
  height: 20px;
  fill: #ccc;
  transition: all 0.2s ease;
}

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

.favorite-btn.active svg {
  fill: #ff4757;
}

.favorite-btn:hover svg {
  fill: #ff6b6b;
}

.viewed-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   RECENT SEARCHES
   ============================================ */
.recent-searches {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  margin-top: 0.5rem;
  max-width: 400px;
}

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

.recent-searches-header span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--coral);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: rgba(255, 107, 107, 0.1);
}

.recent-searches-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: none;
  background: #f8f8f8;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-size: 0.9375rem;
  color: var(--text);
}

.recent-search-item:hover {
  background: #f0f0f0;
  transform: translateX(4px);
}

.recent-search-item svg {
  color: var(--text-soft);
  flex-shrink: 0;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
.settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.settings-content {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: white;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  animation: slideInRight 0.3s ease;
}

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

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.settings-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  color: var(--text);
  margin: 0;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #eee;
  transform: rotate(90deg);
}

.settings-section {
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
}

.settings-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

/* Theme Options */
.theme-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.theme-btn {
  flex: 1;
  min-width: 100px;
  padding: 1rem;
  border: 2px solid #eee;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9375rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn:hover {
  border-color: var(--ocean);
  transform: translateY(-2px);
}

.theme-btn.active {
  border-color: var(--ocean);
  background: linear-gradient(135deg, #e0f7ff 0%, #f0fcff 100%);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

/* Settings Action Buttons */
.settings-action-btn {
  width: 100%;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid #eee;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 0.9375rem;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-action-btn:hover {
  background: #f8f8f8;
  border-color: #ddd;
  transform: translateX(4px);
}

.settings-action-btn.danger {
  color: #dc3545;
  border-color: #ffcdd2;
}

.settings-action-btn.danger:hover {
  background: #ffebee;
  border-color: #ef9a9a;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 12px;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ocean);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   THEME TOGGLE BUTTON (in nav/header)
   ============================================ */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   DARK MODE STYLES
   ============================================ */
[data-theme="dark"] .favorites-section,
[data-theme="dark"] .recently-viewed-section {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-theme="dark"] .favorites-section h2,
[data-theme="dark"] .recently-viewed-section h2 {
  color: #fff;
}

[data-theme="dark"] .recent-searches {
  background: #252542;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .recent-searches-header {
  border-color: #3a3a5c;
}

[data-theme="dark"] .recent-search-item {
  background: #1a1a2e;
  color: #e0e0e0;
}

[data-theme="dark"] .recent-search-item:hover {
  background: #252542;
}

[data-theme="dark"] .settings-content {
  background: #1a1a2e;
  color: #e0e0e0;
}

[data-theme="dark"] .settings-header,
[data-theme="dark"] .settings-section {
  border-color: #3a3a5c;
}

[data-theme="dark"] .settings-header {
  background: #1a1a2e;
}

[data-theme="dark"] .close-btn {
  background: #252542;
  color: #e0e0e0;
}

[data-theme="dark"] .close-btn:hover {
  background: #3a3a5c;
}

[data-theme="dark"] .theme-btn {
  background: #252542;
  border-color: #3a3a5c;
  color: #e0e0e0;
}

[data-theme="dark"] .theme-btn.active {
  background: linear-gradient(135deg, #0c4a6e 0%, #1a5a7e 100%);
  border-color: var(--ocean);
}

[data-theme="dark"] .settings-action-btn {
  background: #252542;
  border-color: #3a3a5c;
  color: #e0e0e0;
}

[data-theme="dark"] .settings-action-btn:hover {
  background: #3a3a5c;
}

[data-theme="dark"] .stat-item {
  background: #252542;
}

[data-theme="dark"] .stat-label {
  color: #888;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .favorites-section,
  .recently-viewed-section {
    padding: 2rem 4%;
  }

  .favorites-section h2,
  .recently-viewed-section h2 {
    font-size: 1.5rem;
  }

  .favorites-grid,
  .viewed-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }

  .settings-content {
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .theme-options {
    flex-direction: column;
  }

  .theme-btn {
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .favorites-grid,
  .viewed-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .settings-content {
    animation: none;
  }

  .favorite-btn,
  .theme-btn,
  .settings-action-btn,
  .recent-search-item {
    transition: none;
  }
}

/* Focus styles for keyboard navigation */
.favorite-btn:focus-visible,
.theme-btn:focus-visible,
.settings-action-btn:focus-visible,
.recent-search-item:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid var(--ocean);
  outline-offset: 2px;
}
