/* vv styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: #1a1a1a;
  background: #fafafa;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Profile Header */
.profile-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

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

.profile-header .stats {
  color: #666;
  font-size: 0.9rem;
}

/* Sections */
section {
  margin-bottom: 2rem;
}

section h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 1rem;
}

/* VV Top Grid */
.vv-top {
  margin-bottom: 2.5rem;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

/* Links List */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Link Card */
.link-card {
  display: block;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.link-card:hover {
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.link-image {
  width: 100%;
  height: 100px;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
}

.links-grid .link-image {
  height: 90px;
}

.link-content {
  padding: 0.75rem;
}

.link-title {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.link-domain {
  display: inline;
  font-size: 0.8rem;
  color: #888;
}

/* Link Description — truncated to 2 lines */
.link-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #666;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

/* Link Badge — for place types, publishers, and domain fallback */
.link-badge {
  display: inline-block;
  font-size: 11px;
  color: #666;
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Inline Link Card — thumbnail on left, content on right */
.link-card-inline {
  display: flex;
  align-items: stretch;
  height: 140px; /* Fixed height for consistent cards regardless of content */
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.link-card-inline:hover {
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Inline thumbnail — square, matches card height */
.link-thumbnail {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
}

/* Favicon thumbnail — square container, icon centered */
.link-thumbnail-favicon {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
}

.link-thumbnail-favicon img {
  width: 40px;
  height: 40px;
}

/* Inline card content — CSS Grid layout for consistent element positioning */
.link-card-inline .link-content {
  display: grid;
  grid-template-rows: auto auto 1fr auto; /* title, badge, description-area, meta */
  row-gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  height: 100%; /* Fill card height so 1fr works */
}

/* Explicit grid row assignments ensure consistent positioning regardless of which elements exist */
.link-card-inline .link-title {
  grid-row: 1;
  -webkit-line-clamp: 1;
}

.link-card-inline .link-badge {
  grid-row: 2;
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-inline .link-description {
  grid-row: 3;
  align-self: start;
}

.link-card-inline .link-meta {
  grid-row: 4;
  align-self: end;
}

/* Date Headers — subtle grouping within Recent/Your Links sections */
.date-header {
  font-size: 0.8rem;
  font-weight: 500;
  color: #999;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
}

.date-header:first-child,
.date-group:first-child .date-header {
  margin-top: 0;
}

/* Date display on link cards (domain · date format) */
.link-date {
  font-size: 0.8rem;
  color: #aaa;
}

/* Separator dot between domain and date */
.link-date:not(:empty)::before {
  content: ' · ';
  color: #ccc;
}

/* Link meta container for domain + date inline display */
.link-meta {
  display: block;
  font-size: 0.8rem;
  color: #888;
}

/* Empty States */
.empty-state,
.empty-section {
  text-align: center;
  padding: 2rem 1rem;
  color: #888;
}

.empty-section {
  padding: 1rem;
}

/* Error Pages */
.error-page {
  display: flex;
  flex-direction: column;
  min-height: 80vh;
}

.error-header {
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.error-header .logo-link {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
}

.error-header .logo-link:hover {
  color: #333;
}

/* 404 Page */
.not-found {
  text-align: center;
  padding: 4rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.not-found h1 {
  font-size: 4rem;
  font-weight: 700;
  color: #ddd;
  margin-bottom: 0.5rem;
}

.not-found p {
  color: #666;
  margin-bottom: 1.5rem;
}

.not-found a {
  color: #1a1a1a;
  text-decoration: underline;
}

/* Homepage */
.home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.home-content {
  text-align: center;
  padding: 2rem 1rem;
}

.home-logo {
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.home-tagline {
  font-size: 1.25rem;
  color: #666;
  font-weight: 400;
}

@media (max-width: 500px) {
  .home-logo {
    font-size: 4rem;
  }

  .home-tagline {
    font-size: 1.1rem;
  }
}

@media (max-width: 375px) {
  .home-logo {
    font-size: 3rem;
  }

  .home-tagline {
    font-size: 1rem;
  }
}

/* Site Logo */
.site-logo {
  height: 24px;
  width: auto;
  display: block;
}

.site-logo:hover {
  opacity: 0.8;
}

.home-logo-img {
  height: 80px;
  width: auto;
  margin-bottom: 1rem;
}

@media (max-width: 500px) {
  .home-logo-img {
    height: 64px;
  }
}

@media (max-width: 375px) {
  .home-logo-img {
    height: 48px;
  }
}

/* Logo Header - subtle top-corner positioning */
.logo-header {
  margin-bottom: 1.5rem;
}

.logo-header a {
  display: inline-block;
}

/* Login Page */
.login-container {
  width: 100%;
  max-width: 320px;
  padding: 0 1rem;
}

.login-container h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  word-wrap: break-word;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-container input {
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  min-height: 44px;
}

.login-container button {
  padding: 0.75rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
}

.login-container button:hover {
  background: #333;
}

.error {
  color: #d32f2f;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Edit Page */
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
  gap: 1rem;
}

.edit-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

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

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  min-height: 44px;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #333;
}

.btn-primary:disabled {
  background: #999;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
  border-color: #ccc;
  background: #fafafa;
}

.btn-text {
  background: none;
  color: #666;
  padding: 0.5rem;
}

.btn-text:hover {
  color: #1a1a1a;
}

.btn-icon {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  color: #888;
  transition: all 0.15s;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  border-color: #ccc;
  color: #1a1a1a;
}

.btn-icon.featured {
  color: #f5a623;
  border-color: #f5a623;
}

.btn-icon.btn-delete:hover:not(:disabled) {
  border-color: #d32f2f;
  color: #d32f2f;
  background: #fef2f2;
}

/* Disabled states */
.btn-icon:disabled,
.visibility-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Add Link Section */
.add-link-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.add-link-section h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 1rem;
}

.add-link-form {
  display: flex;
  gap: 0.5rem;
}

.add-link-form input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
}

.add-link-form input:focus {
  outline: none;
  border-color: #1a1a1a;
}

.add-link-form input:disabled {
  background: #f5f5f5;
}

/* Links Section */
.links-section h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 1rem;
}

.links-section h2 .count {
  font-weight: 400;
  text-transform: none;
}

/* Edit Links List */
.edit-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.edit-link-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  gap: 1rem;
}

.edit-link-card[data-visibility="private"] {
  background: #f9f9f9;
  border-style: dashed;
}

.edit-link-card[data-visibility="draft"] {
  background: #fffbf0;
  border-color: #f5d89a;
}

.link-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

/* Edit page thumbnail */
.link-info .link-thumbnail,
.link-info .link-thumbnail-favicon {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
}

.link-info .link-thumbnail-favicon img {
  width: 24px;
  height: 24px;
}

.link-info-text {
  flex: 1;
  min-width: 0;
}

.link-title-row {
  text-decoration: none;
  color: inherit;
}

.link-title-row:hover .link-title {
  text-decoration: underline;
}

.link-info .link-title {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-info .link-domain {
  font-size: 0.8rem;
  color: #888;
}

.link-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.visibility-select {
  padding: 0.4rem 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  cursor: pointer;
  min-height: 44px;
}

.visibility-select:focus {
  outline: none;
  border-color: #1a1a1a;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  /* Profile header */
  .profile-header h1 {
    font-size: 1.5rem;
  }

  .profile-header .stats {
    font-size: 0.85rem;
  }

  /* Link cards - reduce padding on mobile */
  .link-content {
    padding: 0.625rem;
  }

  /* VV Top grid - single column on small screens */
  .links-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 500px) {
  /* Edit page */
  .edit-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .edit-link-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .link-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .add-link-form {
    flex-direction: column;
  }

  .add-link-form button {
    width: 100%;
  }

  /* 404 page */
  .not-found h1 {
    font-size: 3rem;
  }

  .not-found {
    padding: 2rem 1rem;
  }
}

@media (max-width: 375px) {
  /* Very small screens */
  main {
    padding: 1.5rem 0.75rem;
  }

  .profile-header h1 {
    font-size: 1.25rem;
  }

  /* Hide link images on very small screens to save space */
  .links-grid .link-image {
    height: 70px;
  }

  .link-image {
    height: 80px;
  }

  .not-found h1 {
    font-size: 2.5rem;
  }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-success {
  background: #059669;
}

.toast-error {
  background: #dc2626;
}

@media (max-width: 500px) {
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}

/* Site Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid #e0e0e0;
  color: #888;
  font-size: 0.85rem;
}

.site-footer a {
  color: #666;
  text-decoration: none;
}

.site-footer a:hover {
  color: #1a1a1a;
  text-decoration: underline;
}

.footer-divider {
  margin: 0 0.5rem;
  color: #ccc;
}

/* Legal Pages */
.legal-page {
  max-width: 700px;
}

.legal-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.legal-header .logo-link {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
}

.legal-header .logo-link:hover {
  color: #333;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.legal-content .effective-date {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.legal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.legal-content ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.legal-content a {
  color: #1a1a1a;
  text-decoration: underline;
}

.legal-content a:hover {
  color: #333;
}

@media (max-width: 500px) {
  .legal-content h1 {
    font-size: 1.5rem;
  }

  .legal-content h2 {
    font-size: 1.1rem;
  }
}
