/* -----------------------------------
   Base & reset
----------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #f7f7f7;
  color: #333;
  line-height: 1.4;
}

/* -----------------------------------
   Header
----------------------------------- */
.site-header {
  background: #fff;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}
.site-header h1 {
  font-size: 2rem;
  font-weight: 400;
}

/* -----------------------------------
   Empty state
----------------------------------- */
.empty-state {
  text-align: center;
  padding: 2rem;
  font-size: 1.2rem;
  color: #666;
}

/* -----------------------------------
   Grid layout
----------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 0 1rem 2rem;
}

/* -----------------------------------
   Card style
----------------------------------- */
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* -----------------------------------
   Thumbnail container
----------------------------------- */
.thumb {
  width: 100%;
  padding-top: 56.25%; /* 16:9 ratio */
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* -----------------------------------
   Card content
----------------------------------- */
.card-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0 0 0.25rem 0;        /* small gap below title */
  display: -webkit-box;
  -webkit-line-clamp: 2;        /* clamp to two lines */
  -webkit-box-orient: vertical;  
  overflow: hidden;
}
.card-url {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.75rem 0;        /* space before actions */
  word-break: break-all;
}
.card-notes {
  font-size: 0.85rem;
  color: #333;
  margin: 0.5rem 0;
  white-space: pre-wrap;
}

/* -----------------------------------
   Actions (Notes & Delete)
----------------------------------- */
.card-actions {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
}
.card-actions button {
  padding: 0.5rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #eee;
  transition: background .2s;
}
/* Notes & Tags button: two-thirds width */
.card-actions .btn-outline-primary {
  flex: 2;
}
/* Delete button: one-third width */
.card-actions .btn-outline-danger {
  flex: 1;
}
.card-actions button:hover {
  background: #ddd;
}

/* -----------------------------------
   Notes Modal
----------------------------------- */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #fff;
  padding: 1rem;
  width: 90%;
  max-width: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.modal-content h3 {
  margin-bottom: 0.5rem;
  font-weight: 500;
}
#notesInput {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.modal-buttons {
  text-align: right;
}
.modal-buttons button {
  margin-left: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.modal-buttons button:first-child {
  background: #35a;
  color: #fff;
}
.modal-buttons button:last-child {
  background: #ccc;
}

/* -----------------------------------
   Sidebar
----------------------------------- */
.sidebar {
  background-color: #fff;
  border-right: 1px solid #dee2e6;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 1rem;
}

/* -----------------------------------
   Overrides & helpers
----------------------------------- */
.card-img-top {
  object-fit: cover;
  height: 150px;
}
.badge {
  margin-right: .25rem;
}
#edit-tags-container .badge {
  display: inline-flex;
  align-items: center;
  margin-right: .5rem;
  margin-bottom: .5rem;
}
#edit-tags-container .remove {
  margin-left: .3em;
  cursor: pointer;
}
/* -----------------------------------
   Range input (slider) styling
----------------------------------- */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #ddd;          /* track color */
  border-radius: 3px;
  outline: none;
  margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  background: #ddd;          /* track color */
  border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #007bff;       /* thumb color */
  border-radius: 50%;
  cursor: pointer;
  margin-top: -5px;          /* center thumb on track */
}
input[type=range]:focus::-webkit-slider-runnable-track {
  background: #ccc;
}

/* Firefox */
input[type=range]::-moz-range-track {
  height: 6px;
  background: #ddd;
  border-radius: 3px;
}
input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #007bff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* IE/Edge */
input[type=range]::-ms-track {
  width: 100%;
  height: 6px;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
input[type=range]::-ms-fill-lower {
  background: #ddd;
  border-radius: 3px;
}
input[type=range]::-ms-fill-upper {
  background: #ddd;
  border-radius: 3px;
}
input[type=range]::-ms-thumb {
  width: 16px;
  height: 16px;
  background: #007bff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  margin-top: 0; /* IE aligns differently */
}
.col.pinned > .card {
  border: 2px solid #0d6efd !important;
}