/* MyPhotoNote - Optimized Layout Styles (Compact Version) */



/* Main Container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar Styles - Overlay Mode */
.sidebar {
  width: 400px;
  min-width: 400px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
  position: fixed;
  left: 0;
  top: 0; /* Changed to 0 - sidebar starts from browser top */
  bottom: 0;
  z-index: 1000; /* Increased z-index for overlay */
  overflow: hidden;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3); /* Add shadow for depth */
}

.main-container.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  transform: translateX(-100%);
  overflow: hidden;
}

/* Optional: Add backdrop when sidebar is open */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none; /* Allow clicks to pass through when hidden */
}

.main-container:not(.sidebar-collapsed) .sidebar-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto; /* Enable clicks when visible */
}

.sidebar-nav {
  padding: 1.25rem 1.5rem; /* 1.5rem → 1.25rem (上下パディング削減) */
  border-bottom: 1px solid var(--border-default);
}

.nav-section {
  margin-bottom: 1.25rem; /* 1.5rem → 1.25rem */
}

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

.nav-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem; /* 0.75rem → 0.5rem */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem; /* 0.75rem → 0.625rem */
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  margin-bottom: 0.375rem; /* 0.5rem → 0.375rem */
}

.nav-btn:last-child {
  margin-bottom: 0;
}

.nav-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.nav-btn.primary:hover {
  background: #3b82f6;
}

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

.nav-btn.danger:hover {
  background: var(--color-danger);
  color: white;
}

.nav-btn.small {
  padding: 0.375rem 0.625rem; /* 0.5rem 0.75rem → 0.375rem 0.625rem */
  font-size: var(--font-size-xs);
}

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

.btn-icon {
  font-size: 0.875rem; /* 1rem → 0.875rem */
}

/* Bulk Actions - レイアウトのみ（スタイルはtailwind-replacement.cssに統一済み） */
.bulk-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.375rem;
}

/* Albums Section in Sidebar */
.albums-section {
  flex: 1;
  padding: 0 1.5rem 1.25rem; /* 1.5rem → 1.25rem */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.albums-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Main Content Area - Fixed position, no shifting */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: 0; /* Changed to 0 - content doesn't shift */
  transition: none; /* Remove transition since content doesn't move */
  position: relative;
  width: 100%;
}

.main-container.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* Content Header - 大幅に高さを削減 */
.content-header {
  padding: 0.75rem 1.5rem; /* 1.5rem 2rem → 0.75rem 1.5rem */
  margin-top: 100px; /* タブナビゲーション（約90px）+ 余裕（10px）分のマージン */
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: auto; /* 高さを最小限に */
  flex-wrap: nowrap; /* 折り返し禁止 */
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* 1rem → 0.75rem */
}

.section-title h2 {
  font-size: var(--font-size-xl); /* var(--font-size-2xl) → var(--font-size-xl) */
  font-weight: 600;
  color: var(--text-primary);
  margin: 0; /* マージンを確実に0に */
}

.view-controls {
  display: flex;
  gap: 0.375rem; /* 0.5rem → 0.375rem */
}

.close-album-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0; /* サイズを固定 */
}

.close-album-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  transform: scale(1.05);
}

.close-album-btn .material-symbols-outlined {
  font-size: 24px;
  font-weight: 500;
}

.add-images-btn,
.export-album-btn,
.delete-album-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: var(--font-size-xs);
}

/* 画像を追加ボタンだけ強調色 */
.add-images-btn.primary {
  background: var(--accent-primary);
  color: #fff;
  border: 1px solid var(--accent-primary);
  font-weight: 600;
}
.add-images-btn.primary:hover {
  background: var(--accent-secondary, #1976d2);
  border-color: var(--accent-secondary, #1976d2);
  color: #fff;
  transform: translateY(-1px);
}

/* 他のボタンのhover */
.export-album-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--color-primary);
}
.delete-album-btn.danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.delete-album-btn.danger:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

/* ゴミ箱フィルタ時の削除ボタンスタイル */
.delete-album-btn[data-trash-mode="true"] {
  animation: pulse-danger 2s infinite;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2); }
  50% { box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.3); }
}

.add-images-btn:hover,
.export-album-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

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

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

.content-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* 1rem → 0.75rem */
}

/* .action-btn はTailwindCSSに統一（index.html内の@layer components） */

.album-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* 1rem → 0.75rem */
}

.album-count-display,
.album-count {
  font-size: var(--font-size-xs); /* var(--font-size-sm) → var(--font-size-xs) */
  color: var(--muted-text);
  font-weight: 500;
}

/* Filter Section - 高さを大幅に削減 */
.filter-section {
  padding: 0.5rem 1.5rem; /* 1rem 2rem → 0.5rem 1.5rem */
  border-bottom: 1px solid var(--border-default);
  background: var(--primary-bg);
}

/* Albums Main Grid */
.albums-main-grid {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem; /* 2rem → 1.5rem */
}

/* Gallery Container */
.gallery-container {
  flex: 1;
  overflow-y: auto;
}

/* Empty Gallery Styles */
.empty-gallery-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.5rem; /* 2rem → 1.5rem */
  box-sizing: border-box;
  background-color: var(--primary-bg);
}

.empty-gallery-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem; /* 1rem → 0.75rem */
  color: var(--text-secondary);
  max-width: 400px;
}

.empty-gallery-content .empty-icon .material-symbols-outlined {
  font-size: 3rem; /* 3.5rem → 3rem */
  color: var(--muted-text);
  opacity: 0.8;
}

.empty-gallery-content h3 {
  font-size: var(--font-size-lg); /* var(--font-size-xl) → var(--font-size-lg) */
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.empty-gallery-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.empty-gallery-content .primary-btn {
    margin-top: 0.75rem; /* 1rem → 0.75rem */
    display: inline-flex;
    align-items: center;
    gap: 0.375rem; /* 0.5rem → 0.375rem */
    padding: 0.625rem 1.25rem; /* 0.75rem 1.5rem → 0.625rem 1.25rem */
    font-size: var(--font-size-xs); /* var(--font-size-sm) → var(--font-size-xs) */
    font-weight: 500;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.empty-gallery-content .primary-btn:hover {
    background: #3b82f6;
}



@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 50px; /* 70px → 50px */
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .main-container:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 1rem;
    height: 45px; /* 60px → 45px (モバイルでさらに削減) */
  }
  
  .header-left {
    gap: 0.5rem;
  }
  
  .app-title {
    font-size: var(--font-size-md); /* var(--font-size-lg) → var(--font-size-md) */
  }
  
  .header .album-info,
  .header-left .album-info {
    margin-left: calc(0.375rem + 80px) !important; /* Add 20px more (60px + 20px) */
    gap: 0.5rem !important; /* Reduce gap on tablet */
    flex-direction: row !important; /* Maintain row layout */
  }
  
  .sort-dropdown-container {
    margin-left: 0.25rem;
    margin-right: 0.75rem; /* Slightly less space on tablet */
  }
  
  
  .sidebar {
    width: 320px;
    top: 45px; /* 60px → 45px */
  }
  
  .sidebar-nav {
    padding: 0.75rem; /* 1rem → 0.75rem */
  }
  
  .albums-section {
    padding: 0 0.75rem 0.75rem; /* 0 1rem 1rem → 0 0.75rem 0.75rem */
  }
  
  .content-header {
    padding: 0.5rem; /* 1rem → 0.5rem */
    flex-wrap: nowrap; /* 折り返し禁止を維持 */
    gap: 0.5rem; /* 0.75rem → 0.5rem */
  }
  
  .content-actions {
    flex-wrap: wrap;
    gap: 0.375rem; /* 0.5rem → 0.375rem */
  }
  
  /* .action-btn のレスポンシブスタイルもTailwindCSSで管理 */
  
  .filter-section {
    padding: 0.375rem 0.75rem; /* 0.75rem 1rem → 0.375rem 0.75rem */
  }
  
  .albums-main-grid,
  .gallery-container {
    padding: 0.75rem; /* 1rem → 0.75rem */
  }
}

@media (max-width: 480px) {
  .header .album-info,
  .header-left .album-info {
    margin-left: calc(0.125rem + 60px) !important; /* Add 20px more (40px + 20px) */
    gap: 0.25rem !important; /* Minimal gap on mobile */
    flex-direction: row !important; /* Maintain row layout */
  }
  
  
  .image-count {
    font-size: var(--font-size-xs); /* Smaller count on mobile */
  }
  
  .sort-dropdown-container {
    margin-left: 0.125rem;
    margin-right: 0.5rem; /* Minimal space on mobile */
  }
  
  .bulk-actions {
    grid-template-columns: 1fr;
  }
  
  .nav-btn {
    padding: 0.375rem 0.5rem; /* 0.5rem 0.75rem → 0.375rem 0.5rem */
    font-size: var(--font-size-xs);
  }
  
  .content-header {
    padding: 0.375rem; /* 0.75rem → 0.375rem */
  }
  
  .section-title h2 {
    font-size: var(--font-size-lg); /* var(--font-size-xl) → var(--font-size-lg) */
  }
}


.gallery-album-name.editing {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  outline: 2px solid var(--accent-primary);
}
