/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --hfcbook-color: #3b82f6;
  --tablacus-color: #22c55e;
}

body {
  font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary-color), #7c3aed);
  color: white;
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.header p {
  opacity: 0.9;
  font-size: 0.95rem;
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Sections */
section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

section h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--text-color);
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-color);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.upload-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.upload-progress {
  margin-top: 1rem;
  padding: 0 2rem;
}

.upload-progress-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Import Log */
.import-log {
  margin-top: 1rem;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.import-log-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.import-log-header h4 {
  font-size: 1rem;
  margin: 0;
}

.import-log-badge {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.import-log-badge.success {
  background: #dcfce7;
  color: #166534;
}

.import-log-badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.import-log-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.import-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.import-log-item {
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.import-log-item.error {
  color: var(--danger-color);
}

.import-log-item.success {
  color: var(--success-color);
}

/* File Info */
.file-info {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: var(--radius);
}

.file-info h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
}

.file-item .file-name {
  font-weight: 500;
}

.file-item .file-type {
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: white;
}

.file-type.hfcbook {
  background: var(--hfcbook-color);
}

.file-type.tablacus {
  background: var(--tablacus-color);
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

.toolbar-left h2 {
  margin: 0;
}

.item-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.search-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 200px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* Bookmark Container */
.bookmark-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* Bookmark Panel */
.bookmark-panel {
  background: var(--bg-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  font-size: 1rem;
  margin: 0;
}

.panel-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#hfcbookPanel .panel-header {
  border-left: 4px solid var(--hfcbook-color);
}

#tablacusPanel .panel-header {
  border-left: 4px solid var(--tablacus-color);
}

/* Bookmark Tree */
.bookmark-tree {
  max-height: 600px;
  overflow-y: auto;
  padding: 0.5rem;
}

.bookmark-item {
  margin: 2px 0;
  border-radius: 4px;
  transition: background 0.1s;
}

.bookmark-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.bookmark-item.selected {
  background: rgba(37, 99, 235, 0.1);
}

.bookmark-row {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.bookmark-row .icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.bookmark-row .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.bookmark-row .path {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.bookmark-children {
  margin-left: 1.25rem;
  padding-left: 0.75rem;
  border-left: 1px dashed var(--border-color);
}

.bookmark-children.collapsed {
  display: none;
}

/* Group Toggle */
.group-toggle {
  cursor: pointer;
  transition: transform 0.2s;
}

.group-toggle.collapsed {
  transform: rotate(-90deg);
}

/* Separator */
.bookmark-separator {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 1rem;
}

/* Drag & Drop Styles */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 0 0.25rem;
  user-select: none;
  font-size: 0.85rem;
}

.drag-handle:hover {
  color: var(--text-color);
}

.bookmark-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.bookmark-item.drop-before {
  border-top: 3px solid var(--primary-color);
  margin-top: 3px;
}

.bookmark-item.drop-after {
  border-bottom: 3px solid var(--primary-color);
  margin-bottom: 3px;
}

.bookmark-item.drop-inside {
  background: rgba(37, 99, 235, 0.15);
  border: 2px dashed var(--primary-color);
}

.bookmark-separator.dragging {
  opacity: 0.4;
}

.bookmark-separator.drop-before {
  border-top: 3px solid var(--primary-color);
  margin-top: 3px;
}

.bookmark-separator.drop-after {
  border-bottom: 3px solid var(--primary-color);
  margin-bottom: 3px;
}

/* Export Section */
.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 180px;
}

.context-menu ul {
  list-style: none;
}

.context-menu li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: background 0.1s;
}

.context-menu li:hover {
  background: var(--bg-color);
}

.context-menu li.separator {
  padding: 0;
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
  cursor: default;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

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

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

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.form-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Footer */
.footer {
  background: var(--card-bg);
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* Stats Section */
.stats-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
}

.stats-section h2 {
  color: white;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Collections Section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.collections-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
}

.collection-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
}

.collection-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.collection-icon {
  font-size: 1.5rem;
}

.collection-details h4 {
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
}

.collection-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.collection-meta span {
  margin-right: 1rem;
}

.collection-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.empty-message {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

/* Bookmark Tree Container */
.bookmark-tree-container {
  background: var(--bg-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.bookmark-tree-container .bookmark-tree {
  max-height: calc(100vh - 400px);
  min-height: 300px;
}

/* Source Badge */
.source-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.source-badge.hfcbook {
  background: var(--hfcbook-color);
  color: white;
}

.source-badge.tablacus {
  background: var(--tablacus-color);
  color: white;
}

.source-badge.merged {
  background: var(--warning-color);
  color: white;
}

/* Modal Small */
.modal-sm {
  max-width: 400px;
}

/* Loading Spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin-left: 0.5rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   認証関連スタイル
   ========================================== */

/* Header with Auth */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px;
  margin: 0 auto;
}

.header-title {
  text-align: left;
}

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

.auth-hint {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-name {
  font-weight: 500;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-provider {
  font-size: 0.9rem;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Login Screen */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  z-index: 100;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.login-header {
  margin-bottom: 2rem;
}

.login-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.login-header h2 {
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.login-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.login-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Login Buttons */
.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-login .btn-icon {
  font-size: 1.25rem;
}

.btn-google {
  background: #4285f4;
  color: white;
}

.btn-google:hover {
  background: #3367d6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.btn-github {
  background: #24292e;
  color: white;
}

.btn-github:hover {
  background: #1b1f23;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 41, 46, 0.4);
}

.error-message {
  color: var(--danger-color);
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
}

/* ==========================================
   エクスポートモーダル
   ========================================== */
.export-option-info {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.export-option-info p {
  margin: 0;
  color: #92400e;
  font-size: 0.9rem;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-option-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--bg-color);
}

.export-option-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-option-card p {
  margin: 0 0 1rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.export-option-card.recommended {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.badge {
  font-size: 0.7rem;
  background: var(--primary-color);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: normal;
}

/* Tablacus Export Modal Enhancements */
.export-notes {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  font-size: 0.9rem;
}

.export-notes li {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.merge-export-steps {
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem 0;
}

.merge-export-steps h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--primary-color);
}

.merge-export-steps ol {
  margin: 0;
  padding-left: 1.5rem;
  font-size: 0.9rem;
}

.merge-export-steps li {
  margin-bottom: 0.5rem;
}

.merge-export-steps code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.85em;
}

.export-warning {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
  padding: 1rem;
  margin-top: 1.5rem;
}

.export-warning p {
  margin: 0 0 0.5rem 0;
  font-weight: bold;
  color: var(--danger-color);
}

.export-warning ul {
  margin: 0;
  padding-left: 1.5rem;
  font-size: 0.9rem;
}

.export-warning li {
  margin-bottom: 0.5rem;
}

/* Diff Merge Modal */
.modal-lg {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.diff-info {
  background: rgba(37, 99, 235, 0.1);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 4px;
}

.diff-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border-color);
  background: var(--bg-color);
}

.summary-card.added {
  border-color: var(--success-color);
  background: rgba(34, 197, 94, 0.1);
}

.summary-card.modified {
  border-color: var(--warning-color);
  background: rgba(245, 158, 11, 0.1);
}

.summary-card.removed {
  border-color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

.summary-card.unchanged {
  border-color: var(--secondary-color);
  background: rgba(100, 116, 139, 0.1);
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.summary-count {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-color);
}

.diff-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.diff-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.diff-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
  background: var(--card-bg);
  transition: background 0.2s;
}

.diff-item:hover {
  background: var(--bg-color);
}

.diff-item:last-child {
  border-bottom: none;
}

.diff-item-info {
  flex: 1;
}

.diff-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.diff-type {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.diff-type.added {
  background: var(--success-color);
  color: white;
}

.diff-type.modified {
  background: var(--warning-color);
  color: white;
}

.diff-type.removed {
  background: var(--danger-color);
  color: white;
}

.diff-item-name {
  font-weight: bold;
  color: var(--text-color);
}

.diff-item-path {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 0.25rem;
}

.diff-item-changes {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-color);
  border-radius: 4px;
  font-size: 0.85rem;
}

.diff-change {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.diff-change-label {
  font-weight: bold;
  min-width: 60px;
}

.diff-change-old {
  text-decoration: line-through;
  color: var(--danger-color);
}

.diff-change-new {
  color: var(--success-color);
}

.diff-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 150px;
}

.diff-action-select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.9rem;
}

.diff-action-select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Snapshot Management */
.snapshot-actions {
  margin-bottom: 1.5rem;
}

.snapshot-list {
  max-height: 400px;
  overflow-y: auto;
}

.snapshot-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background: var(--card-bg);
  transition: all 0.2s;
}

.snapshot-item:hover {
  box-shadow: var(--shadow);
}

.snapshot-item.baseline {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

.snapshot-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.snapshot-title {
  font-weight: bold;
  font-size: 1rem;
}

.snapshot-badge {
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.snapshot-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.snapshot-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.snapshot-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Drag and Drop */
.bookmark-item.dragging {
  opacity: 0.5;
}

.bookmark-item.drag-over {
  border-left: 3px solid var(--primary-color);
  background: rgba(37, 99, 235, 0.1);
}

/* Path input with drop support */
.form-group input[type="text"].drop-target {
  border: 2px dashed var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }

  .bookmark-container {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-right {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .collection-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .collection-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .diff-item {
    grid-template-columns: 1fr;
  }

  .diff-item-actions {
    width: 100%;
  }

  .diff-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .snapshot-header {
    flex-direction: column;
    gap: 0.5rem;
  }
}
