/**
 * SPA Pages Styles  
 * SPAページ専用のスタイリング - 統一されたUI/UXガイドラインに準拠
 */

/* === Bulk Selection Styles === */
.bulk-actions-bar {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  gap: 1rem;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bulk-actions-left,
.bulk-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* 一括操作スタイルはtailwind-replacement.cssに統一済み */

/* Selection mode button active state */
.action-btn.active {
  background: var(--color-primary) !important;
  color: white !important;
  border-color: var(--color-primary) !important;
}

/* 古い image-checkbox スタイルを完全に無効化 */
.image-checkbox,
input[type="checkbox"].image-checkbox {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* OptimizedImageGalleryの optimized-checkbox クラスのみ使用 */

/* Gallery item selection state */
.gallery-item.selected,
.image-card.selected {
  position: relative;
  transform: scale(0.95);
  transition: all 0.2s ease;
}

.gallery-item.selected::after,
.image-card.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid var(--color-primary);
  border-radius: 8px;
  pointer-events: none;
  background: rgba(0, 123, 255, 0.1);
}

.gallery-item.selected img,
.image-card.selected img {
  opacity: 0.8;
}

/* Bulk Action Dialog */
.bulk-action-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-action-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.bulk-action-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--border-radius, 12px);
  padding: 2rem;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { 
    transform: translateY(-20px) scale(0.95); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

.bulk-action-content h3 {
  margin: 0 0 1.5rem 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.bulk-action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.bulk-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--border-radius, 8px);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.bulk-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bulk-action-btn.delete-btn {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.bulk-action-btn.delete-btn:hover {
  background: var(--color-danger);
  color: white;
}

.bulk-action-btn.cancel-btn:hover {
  background: var(--bg-secondary);
}

/* Responsive adjustments for bulk actions */
@media (max-width: 768px) {
  .bulk-actions-bar {
    padding: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .bulk-actions-left,
  .bulk-actions-right {
    gap: 0.5rem;
  }
  
  .bulk-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .selection-count {
    font-size: 0.8rem;
  }
  
  .bulk-action-content {
    padding: 1.5rem;
    min-width: 280px;
  }
  
  .bulk-action-buttons {
    flex-direction: column;
  }
  
  .bulk-action-btn {
    padding: 0.75rem 1rem;
  }
}

/* === Base Page Styles === */
.spa-page-container {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

.spa-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  background: var(--background-primary, #fefefe);
  color: var(--text-primary);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
}

.spa-page.active {
  display: flex !important;
}

/* === Page Loading States === */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === Page Error States === */
.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.page-error .error-icon {
  font-size: 4rem;
  color: var(--danger-color);
  margin-bottom: 1rem;
}

.page-error h2 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.page-error p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  max-width: 500px;
}

.error-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* === Image Detail Page === */
.page-image-detail {
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* === .image-detail-header moved to header-navigation-unified.css === */

/* Header Top Section - 画像詳細ページ用 */
.image-detail-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.image-detail-header .header-navigation {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.image-detail-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


.image-counter {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-btn, .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border-elevated);
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover, .action-btn:hover {
  background: var(--bg-elevated-alpha);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.action-btn.active {
  color: var(--favorite-active, var(--color-danger)) !important;
  background: rgba(244, 67, 54, 0.1) !important;
}

.action-btn[data-action="restore"].active {
  color: #4CAF50 !important;
  background: rgba(76, 175, 80, 0.15) !important;
  border-color: #4CAF50 !important;
}

/* より具体的なセレクターで確実に適用 */
.image-detail-header .action-btn[data-action="restore"].active {
  color: #4CAF50 !important;
  background: rgba(76, 175, 80, 0.15) !important;
  border-color: #4CAF50 !important;
}

.action-btn.delete-btn {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.action-btn.delete-btn:hover {
  background: rgba(220, 53, 69, 0.1);
  color: var(--color-danger);
}

.action-btn.restore-btn {
  color: #4CAF50;
  border-color: #4CAF50;
}

.action-btn.restore-btn:hover {
  background: rgba(76, 175, 80, 0.1);
  color: #4CAF50;
}

.image-detail-content {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
  position: relative;
  z-index: 1010;
}

.image-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.page-image-detail.sidebar-hidden .image-viewer {
  width: 100%;
}

.sidebar-toggle-btn.rotated .material-symbols-outlined {
  transform: rotate(180deg);
}

.image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  position: relative;
  z-index: 1005;
}

.detail-image {
  max-width: calc(100vw - 350px - 40px);
  max-height: calc(100vh - 200px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.3s ease-in-out;
}

.detail-image.zoomed {
  transform: scale(2) translateY(-20px);
  cursor: zoom-out;
}

.image-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  color: white;
}

.image-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
}

.image-error .material-symbols-outlined {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.image-sidebar {
  width: 320px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border-left: 1px solid #444;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 0;
  position: relative;
  z-index: 1005;
}

.image-sidebar.hidden {
  display: none;
}

.image-info, .image-notes, .image-tags {
  padding: 1rem;
  border-bottom: 1px solid #333;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.image-title {
  display: none; /* 重複表示を除去 */
}

.image-metadata {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metadata-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #333;
  font-size: 0.85rem;
}

.metadata-item.metadata-filename {
  padding-top: 0;
}

.metadata-label {
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 60px;
  font-size: 0.85rem;
}

.metadata-value {
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
  font-size: 0.85rem;
  line-height: 1.3;
}

.image-notes h3,
.image-tags h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.note-content {
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #444;
  border-radius: 4px;
  min-height: 100px;
  color: var(--text-primary);
  line-height: 1.6;
}

.no-note, .no-tags {
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.edit-note-btn, .edit-tags-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #333;
  border: 1px solid var(--border-elevated);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-top: 1rem;
  transition: all 0.15s ease;
}

.edit-note-btn:hover, .edit-tags-btn:hover {
  background: #444;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--color-primary);
  color: white;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* === Albums List Page === */
.page-albums-list {
  background: var(--background-primary, #1a1a1a);
}

/* albums-list-header styles removed - not used in actual implementation */

/* App Title Section */
.app-title-section {
  margin-bottom: 1rem;
}

/* removed */

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary, #aaa);
  font-weight: 500;
}

/* Stats Overview */
.stats-overview {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: var(--bg-elevated-alpha);
  border: 1px solid var(--border-color, #555);
  border-radius: var(--radius-md, 6px);
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  height: 30px;
}

.stat-icon {
  color: var(--primary-color, var(--color-primary));
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary) !important;
  font-weight: 500;
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-elevated);
  border-radius: var(--radius-md, 6px);
  padding: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  gap: 0.5rem;
  min-width: 200px;
  height: 30px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.search-box:focus-within {
  border-color: var(--primary-color, var(--color-primary));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.search-box .material-symbols-outlined {
  color: var(--text-muted) !important;
  font-size: 1.1rem;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff !important;
  font-size: 0.9rem;
  width: 100%;
  min-width: 150px;
}

.search-input::placeholder {
  color: var(--text-muted) !important;
}

.sort-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-elevated);
  border-radius: var(--radius-md, 6px);
  padding: 0.5rem 1.75rem 0.5rem 0.75rem;
  color: #ffffff !important;
  font-size: 0.875rem;
  min-width: 150px;
  min-height: 2.25rem;
  line-height: 1.25rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cccccc' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.9rem;
}

.sort-select:focus {
  border-color: var(--primary-color, var(--color-primary));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.sort-select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  min-height: 2rem;
}

.create-album-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: var(--primary-color, var(--color-primary));
  color: white;
  border: none;
  border-radius: var(--radius-md, 6px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 30px;
}

.create-album-btn:hover {
  background: var(--primary-color-hover, var(--color-primary-hover));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

/* レスポンシブ対応 */
@media (max-width: 1300px) {
   {
    padding: 1rem 1.5rem;
  }
  
  .header-controls {
    gap: 0.75rem;
  }
  
  .search-box {
    min-width: 150px;
  }
  
  .sort-select {
    min-width: 120px;
    font-size: 0.85rem;
    min-height: 2.1rem;
    line-height: 1.2rem;
    padding: 0.45rem 1.6rem 0.45rem 0.7rem;
  }
  
  .create-album-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  .create-album-btn .material-symbols-outlined {
    font-size: 1rem;
  }
  
  .stats-overview {
    gap: 0.75rem;
  }
  
  .stat-item {
    padding: 0.5rem 0.75rem;
  }
  
  .stat-value {
    font-size: 1rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

@media (max-width: 900px) {
   {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }
  
  .header-right {
    align-self: stretch;
  }
  
  .header-controls {
    justify-content: space-between;
  }
  
  .search-box {
    flex: 1;
    min-width: 120px;
  }
  
  .sort-select {
    min-width: 100px;
  }
  
  .create-album-btn {
    flex-shrink: 0;
  }
  
  .stats-overview {
    justify-content: space-between;
  }
  
  .stat-item {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .search-box,
  .sort-select,
  .create-album-btn {
    width: 100%;
    min-width: unset;
  }
}

@media (max-width: 480px) {
   {
    padding: 1rem;
  }
  
  .app-title {
    font-size: 1.25rem;
  }
  
  .stats-overview {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .stat-item {
    justify-content: flex-start;
  }
}

.albums-list-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* Albums Grid for SPA Pages */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

/* Album Card - completely managed by Tailwind classes */

/* Animation definitions moved to albums-grid-optimized.css for unified management */

/* 遅延アニメーションのためのバリエーション */
.album-card:nth-child(1) { animation-delay: 0ms; }
.album-card:nth-child(2) { animation-delay: 100ms; }
.album-card:nth-child(3) { animation-delay: 200ms; }
.album-card:nth-child(4) { animation-delay: 300ms; }
.album-card:nth-child(5) { animation-delay: 400ms; }
.album-card:nth-child(6) { animation-delay: 500ms; }
.album-card:nth-child(7) { animation-delay: 600ms; }
.album-card:nth-child(8) { animation-delay: 700ms; }
.album-card:nth-child(9) { animation-delay: 800ms; }
.album-card:nth-child(10) { animation-delay: 900ms; }
.album-card:nth-child(n+11) { animation-delay: 1000ms; }

/* アルバムカードのホバー効果は albums-grid-optimized.css で管理 */

/* Album Thumbnail for SPA Pages */
.album-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 aspect ratio */
  background: var(--bg-surface);
  overflow: hidden;
}

.album-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-surface);
  
  /* 画像は準備中は非表示 */
  opacity: 1;
  transition: none;
}

/* 画像読み込み完了後 - 特に何もしない（カード全体のアニメーションに任せる） */
.album-thumbnail img.loaded {
  opacity: 1;
}

.album-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-secondary);
}

/* Album Info for SPA Pages */
.album-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* .album-name styles moved to Tailwind classes - managed in albums-grid-optimized.css */

.album-stats {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.album-stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.album-stat-value {
  font-weight: 500;
}

/* === Album Gallery Page === */
.page-album-gallery {
  background: var(--bg-primary) !important;
  color: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100vh !important;
  overflow: hidden !important;
  position: relative;
  z-index: 1005;
}

.album-gallery-header {
  background: #252525;
  border-bottom: 1px solid var(--border-default);
  padding: 0.625rem 2rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  top: 75px;
  z-index: 1010;
}

/* Header Top Section */
.album-gallery-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.album-gallery-header .header-navigation {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.album-gallery-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.album-gallery-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Header Info Section */
.album-gallery-header .header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 2rem;
}

.album-gallery-header .album-title-section {
  flex: 0 1 auto;
  max-width: 510px;
  min-width: 0;
  align-self: center;
}

.album-gallery-header .album-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.album-gallery-header .album-title {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
  max-width: 476px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-gallery-header .album-description {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
  line-height: 1.4;
}

/* Stat Items */
.album-gallery-header .stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-elevated);
  border-radius: 6px;
  white-space: nowrap;
}

.album-gallery-header .stat-item .material-symbols-outlined {
  color: var(--color-primary);
  font-size: 1.2rem;
}

.album-gallery-header .stat-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.album-gallery-header .stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Action Buttons */
.album-gallery-header .action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1px solid var(--border-elevated);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  min-width: fit-content;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 1011;
}

.album-gallery-header .action-btn:hover {
  background: var(--bg-elevated-alpha);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.album-gallery-header .action-btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.album-gallery-header .action-btn.primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.album-gallery-header .action-btn.danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.album-gallery-header .action-btn.danger:hover {
  background: var(--color-danger);
  color: white;
}

/* Close Button */
.album-gallery-header .close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-elevated);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.album-gallery-header .close-btn:hover {
  background: var(--bg-elevated-alpha);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Sort Dropdown - 共通スタイル */
.sort-dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-icon {
  color: var(--text-muted);
  font-size: 1.2rem;
}

.sort-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-elevated);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
}

.sort-select:hover,
.sort-select:focus {
  border-color: var(--color-primary);
  outline: none;
  background: #4a4a4a;
}

.sort-select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Editable Title */
.album-gallery-header .editable-title {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  margin: -4px -8px 0.5rem -8px;
  border-radius: 4px;
}

.album-gallery-header .editable-title:hover {
  background: var(--bg-elevated-alpha);
  outline: 1px solid rgba(255, 255, 255, 0.2);
}

.album-gallery-header .editable-title.editing {
  background: rgba(255, 255, 255, 0.15);
  outline: 2px solid var(--color-primary);
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.3);
}

/* インライン編集の入力フィールドスタイル */
.inline-edit-input {
  background: #2d2d2d !important;
  color: #ffffff !important;
  border: 2px solid #ff6b35 !important;
  border-radius: 4px !important;
  padding: 8px 12px !important;
  font-size: 1.8rem !important;
  font-weight: 600 !important;
  width: 100% !important;
  min-width: 300px !important;
  outline: none !important;
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.3) !important;
}

.album-gallery-header .image-count {
  color: var(--text-secondary, #cccccc);
  font-size: 0.9rem;
  font-weight: 500;
}


.album-gallery-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-primary);
  min-height: 0; /* flexboxの収縮を許可 */
}

/* Gallery Grid for Album Gallery Page */
.album-gallery-content .gallery-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

#gallery-grid-container {
  width: 100%;
  min-height: 200px;
}

.album-gallery-content .gallery-grid,
.optimized-gallery {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 1rem !important;
  padding: 0 !important;
  width: 100% !important;
  position: relative;
  top: 20px;
}

.album-gallery-content .gallery-item,
.album-gallery-content .image-card,
.image-card {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #444;
  cursor: pointer;
}

.album-gallery-content .gallery-item:hover,
.album-gallery-content .image-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.album-gallery-content .gallery-item img,
.album-gallery-content .image-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.album-gallery-content .gallery-item .filename,
.album-gallery-content .image-card .image-name {
  padding: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Album Gallery Responsive Design */
@media (max-width: 1024px) {
  .album-gallery-header {
    padding: 1rem 1.5rem;
  }
  
  .album-gallery-header .header-info {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .album-gallery-header .album-stats {
    gap: 1rem;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .album-gallery-header {
    padding: 1rem;
    gap: 1rem;
  }
  
  .album-gallery-header .header-top {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .album-gallery-header .header-actions {
    justify-content: space-between;
    width: 100%;
  }
  
  .album-gallery-header .action-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  .album-gallery-header .sort-select {
    min-width: 120px;
    padding: 0.5rem 0.75rem;
  }
  
  .album-gallery-header .close-btn {
    width: 40px;
    height: 40px;
  }
  
  .album-gallery-header .album-title {
    font-size: 1.5rem;
  }
  
  .album-gallery-header .album-stats {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .album-gallery-header .stat-item {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .album-gallery-header .header-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .album-gallery-header .action-btn {
    width: 100%;
  }
  
  .album-gallery-header .album-title {
    font-size: 1.25rem;
  }
  
  .album-gallery-header .album-stats {
    grid-template-columns: repeat(2, 1fr);
    display: grid;
    gap: 0.5rem;
  }
}

/* === Image Detail Page Responsive Design === */
@media (max-width: 768px) {
  .page-image-detail .image-detail-content {
    flex-direction: column !important;
  }
  
  .page-image-detail .image-viewer {
    width: 100% !important;
    height: 60vh !important;
    min-height: 300px;
  }
  
  .page-image-detail .image-sidebar {
    width: 100% !important;
    height: 40vh !important;
    min-height: 200px !important;
    border-left: none !important;
    border-top: 1px solid #444 !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .page-image-detail .image-viewer {
    height: 50vh !important;
    min-height: 250px;
  }
  
  .page-image-detail .image-sidebar {
    height: 50vh !important;
    min-height: 250px !important;
    padding: 0.5rem !important;
  }
  
  .page-image-detail .image-info,
  .page-image-detail .image-notes,
  .page-image-detail .image-tags {
    padding: 0.75rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .page-image-detail .image-detail-header {
    padding: 0.5rem 1rem !important;
    min-height: 50px !important;
  }
}

/* === Album Edit Page === */
.page-album-edit {
  background: var(--background-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.album-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.album-edit-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0 1rem;
}

.album-edit-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.edit-form-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: var(--background-primary);
}

/* === Page Animations === */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spa-page {
  animation: pageSlideIn 0.4s ease-out;
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .page-image-detail .image-detail-content {
    flex-direction: column;
  }
  
  .page-image-detail .image-viewer {
    min-height: 60vh;
  }
  
  .page-image-detail .image-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid #444;
    max-height: 40vh;
  }
  
  .image-detail-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .header-left, .header-right {
    justify-content: space-between;
  }
  
  .detail-image {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px - 40px);
  }
  
}

@media (max-width: 480px) {
  .nav-btn, .action-btn {
    width: 40px;
    height: 40px;
  }
  
  .image-info, .image-notes, .image-tags {
    padding: 1rem;
  }
  
  .metadata-item {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .metadata-value {
    text-align: left;
  }
  
  .image-sidebar {
    width: 100vw;
    position: absolute;
    top: 0;
    right: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 20;
  }
  
  .image-sidebar.show {
    transform: translateX(0);
  }
  
  .detail-image {
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 80px - 20px);
  }
  
  .image-container {
    padding: 10px;
  }
}

/* === Focus Management === */
.spa-page:focus {
  outline: none;
}

.spa-page [tabindex="-1"]:focus {
  outline: none;
}

/* === Print Styles === */
@media print {
  .image-detail-header,
  .image-sidebar {
    display: none;
  }
  
  .image-viewer {
    width: 100%;
    height: auto;
  }
  
  .detail-image {
    max-width: 100%;
    height: auto;
  }
}

/* === Favorites Page Styles === */

.favorites-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  padding: 1rem 2rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  top: 0;
  z-index: 1015;
}

/* Header Top Section */
.favorites-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.favorites-header .header-navigation {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.favorites-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Header Info Section */
.favorites-header .header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 2rem;
}

.favorites-header .favorites-title-section {
  flex: 0 1 auto;
  max-width: 510px;
  min-width: 0;
  align-self: center;
}

.favorites-header .favorites-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.favorites-header .favorites-title {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.favorites-header .favorites-description {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
  line-height: 1.4;
}

/* Stat Items */
.favorites-header .stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-width: 120px;
}

.favorites-header .stat-item .material-symbols-outlined {
  color: var(--color-danger);
  font-size: 1.2rem;
}

.favorites-header .stat-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.favorites-header .stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Action Buttons */
.favorites-header .action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-elevated);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  min-width: fit-content;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1021;
}

.favorites-header .action-btn:hover {
  background: var(--bg-elevated-alpha);
  border-color: var(--color-danger);
  transform: translateY(-1px);
}

.favorites-header .action-btn.primary {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: white;
}

.favorites-header .action-btn.primary:hover {
  background: #d32f2f;
  border-color: #d32f2f;
}

/* ヘッダー内の選択ボタンのスタイル（フロートパネル以外） */
.favorites-header .header-actions .action-btn.secondary {
  border-color: #666;
  color: var(--text-muted);
}

.favorites-header .header-actions .action-btn.secondary:hover {
  background: var(--bg-elevated-alpha);
  border-color: var(--color-danger);
  color: var(--color-danger);
}


/* Responsive Design */
@media (max-width: 1024px) {
  .favorites-header {
    padding: 1rem 1.5rem;
  }
  
  .favorites-header .header-info {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .favorites-header .favorites-stats {
    gap: 1rem;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .favorites-header {
    padding: 1rem;
    gap: 1rem;
  }
  
  .favorites-header .header-top {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .favorites-header .header-actions {
    justify-content: space-between;
    width: 100%;
  }
}

/* Favorites Content */
.favorites-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  position: relative;
}

.favorites-content .gallery-container {
  width: 100%;
  height: 100%;
}

/* Empty state for favorites */
.empty-favorites {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-muted);
  text-align: center;
}

.empty-favorites .material-symbols-outlined {
  font-size: 6rem;
  color: #666;
  margin-bottom: 1rem;
}

.empty-favorites h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.empty-favorites p {
  margin: 0;
  color: var(--text-muted);
}

/* === Trash Page Styles === */

.trash-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  padding: 1rem 2rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  z-index: 1015;
}

/* Header Top Section */
.trash-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.trash-header .header-navigation {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.trash-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Header Info Section */
.trash-header .header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 2rem;
}

.trash-header .trash-title-section {
  flex: 0 1 auto;
  max-width: 510px;
  min-width: 0;
  align-self: center;
}

.trash-header .trash-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.trash-header .trash-title {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.trash-header .page-description {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
  line-height: 1.4;
}

/* Stat Items */
.trash-header .stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-width: 120px;
}

.trash-header .stat-item .material-symbols-outlined {
  color: #666;
  font-size: 1.2rem;
}

.trash-header .stat-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.trash-header .stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Action Buttons */
.trash-header .action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-elevated);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  min-width: 90px;
  max-width: 120px;
  justify-content: center;
  z-index: 1021;
}

.trash-header .action-btn:hover {
  background: var(--bg-elevated-alpha);
  border-color: #666;
  transform: translateY(-1px);
}

.trash-header .action-btn.primary {
  background: #666;
  border-color: #666;
  color: white;
}

.trash-header .action-btn.primary:hover {
  background: #777;
  border-color: #777;
}

.trash-header .action-btn.secondary {
  border-color: #666;
  color: var(--text-muted);
}

.trash-header .action-btn.secondary:hover {
  background: var(--bg-elevated-alpha);
  border-color: #666;
  color: var(--text-primary);
}

.trash-header .action-btn.danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.trash-header .action-btn.danger:hover {
  background: rgba(244, 67, 54, 0.1);
  border-color: var(--color-danger);
  color: var(--color-danger);
}


/* Responsive Design */
@media (max-width: 1024px) {
  .trash-header {
    padding: 1rem 1.5rem;
  }
  
  .trash-header .header-info {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .trash-header .trash-stats {
    gap: 1rem;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .trash-header {
    padding: 1rem;
    gap: 1rem;
  }
  
  .trash-header .header-top {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .trash-header .header-actions {
    justify-content: space-between;
    width: 100%;
  }
}

/* Trash Content */
.trash-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Empty Trash */
.empty-trash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-muted);
  text-align: center;
}

.empty-trash .material-symbols-outlined {
  font-size: 6rem;
  color: #666;
  margin-bottom: 1rem;
}

.empty-trash h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.empty-trash p {
  margin: 0;
  color: var(--text-muted);
}
