/* Variables */
:root {
  --primary-color: #4a90e2;
  --text-color: #2c3e50;
  --background-color: #f5f7fa;
  --card-background: #ffffff;
  --border-color: #e1e8ed;
  --tag-background: #edf2f7;
  --spacing-unit: 1rem;
  --accent-color: #3182ce;
  --accent-color-dark: #4299e1;
  --private-background: #fbfcf8;
  --private-background-dark: #694848;
}

/* Base styles */
body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0;
  margin: 0;
}

/* Layout */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-unit);
  margin-bottom: var(--spacing-unit);
  flex-wrap: wrap;
  gap: var(--spacing-unit);
}

.page-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

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

.bookmarks-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--spacing-unit);
  padding: var(--spacing-unit);
  max-width: 1400px;
  margin: 0 auto;
}

/* Cards */
.bookmark-card {
  background: var(--card-background);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: calc(var(--spacing-unit) * 1.5);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-unit);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 150px;
}

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

.bookmark-content {
  flex-grow: 1;
}

.bookmark-title {
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  margin: 0 0 0.5rem;
  word-break: break-word;
}

.bookmark-title a {
  color: var(--primary-color);
  text-decoration: none;
}

.bookmark-title a:hover {
  text-decoration: underline;
}

.bookmark-description {
  color: #666;
  font-size: clamp(0.875rem, 2vw, 0.9rem);
  margin: 0.5rem 0;
  word-break: break-word;
}

/* Tags */
.bookmark-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.tag {
  background: var(--tag-background);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: clamp(0.75rem, 1.5vw, 0.8rem);
  color: #4a5568;
  white-space: nowrap;
}

/* Buttons and Actions */
.button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-color);
  text-decoration: none;
  font-size: clamp(0.875rem, 2vw, 0.9rem);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.button:hover {
  background: #f8f9fa;
  border-color: #cbd5e0;
}

.button.primary {
  background: var(--primary-color);
  color: white;
  border: none;
}

.button.primary:hover {
  background: #357abd;
}

/* Import section */
.import-section {
  margin: calc(var(--spacing-unit) * 2) var(--spacing-unit);
  padding: var(--spacing-unit);
  background: var(--card-background);
  border-radius: 8px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.import-form {
  margin-top: var(--spacing-unit);
}

.file-input-wrapper {
  display: flex;
  gap: var(--spacing-unit);
  align-items: center;
  flex-wrap: wrap;
}

/* Notices */
.notice {
  background: #48bb78;
  color: white;
  padding: 1rem;
  margin: 1rem auto;
  border-radius: 6px;
  text-align: center;
  max-width: 1400px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  :root {
    --spacing-unit: 0.75rem;
  }

  .page-header {
    padding: var(--spacing-unit);
  }

  .bookmarks-container {
    padding: var(--spacing-unit);
  }

  .bookmark-card {
    padding: var(--spacing-unit);
  }

  .actions {
    width: 100%;
    justify-content: center;
  }

  .button {
    padding: 0.5rem 0.75rem;
  }

  .file-input-wrapper {
    flex-direction: column;
    width: 100%;
  }

  .file-input-wrapper input[type="file"] {
    width: 100%;
  }

  .file-input-wrapper .button {
    width: 100%;
    justify-content: center;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #1a1a1a;
    --card-background: #2d2d2d;
    --text-color: #e0e0e0;
    --border-color: #404040;
    --tag-background: #404040;
    --accent-color: #4299e1;
    --accent-color-dark: #63b3ed;
    --private-background: var(--private-background-dark);
  }

  .button {
    background: var(--card-background);
    color: var(--text-color);
  }

  .bookmark-description {
    color: #b0b0b0;
  }

  .tag {
    color: #d0d0d0;
  }
}

.search-form {
  flex: 1;
  max-width: 600px;
  margin: 0 var(--spacing-unit);
}

.search-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  background: white;
  color: var(--text-color);
}

.search-input:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

@media (max-width: 640px) {
  .search-form {
    order: 2;
    margin: 0;
    max-width: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .search-input {
    background: var(--card-background);
    color: var(--text-color);
  }
}

.no-results {
  text-align: center;
  color: var(--text-color);
  padding: var(--spacing-unit);
  font-style: italic;
}

.bookmark-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-unit);
}

.private-badge {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1;
}

.is-private {
  background: var(--private-background);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .is-private {
    background: var(--private-background-dark);
  }
}
