/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  background-color: #f9fafb;
  color: #1f2937;
  line-height: 1.5;
}

/* Brand Colors */
:root {
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

/* Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 72rem; /* 1152px */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-100);
}

.header-content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
}

.nav-link:hover {
  color: var(--brand-600);
  background-color: var(--gray-50);
}

.nav-link.active {
  color: var(--white);
  background-color: var(--brand-600);
}

.logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background-color: var(--brand-600);
  color: var(--white);
  display: grid;
  place-items: center;
  font-weight: bold;
}

.site-title {
  font-size: 1.125rem;
  font-weight: 600;
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1rem;
  }

  .nav-link {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* Main Content */
main {
  flex: 1;
}

.main-section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
}

.links-container {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Link Card */
.link-card {
  padding: 0.75rem 1rem;
  background-color: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.15s ease-in-out;
}

.link-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.link-content {
  min-width: 0;
}

.link-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-desc {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--gray-600);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-time {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.link-action {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.share-action {
  justify-content: space-between;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  min-width: 4.5rem;
  height: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: 0.375rem;
  background-color: var(--brand-600);
  color: var(--white);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease-in-out;
  box-sizing: border-box;
}

.link-button:hover {
  background-color: var(--brand-700);
}

.link-button:active {
  transform: scale(0.98);
}

.link-button svg {
  width: 1rem;
  height: 1rem;
}

.copy-button {
  background-color: var(--brand-600);
}

.copy-button:hover {
  background-color: var(--brand-700);
}

/* Action Bar */
.action-bar {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 24rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  pointer-events: none;
}

.search-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.search-input-share {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-900);
  background-color: var(--white);
  transition: all 0.2s;
}

.search-input-share:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.add-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--brand-600);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.add-button:hover {
  background-color: var(--brand-700);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--white);
  border-radius: 1rem;
  width: 100%;
  max-width: 32rem;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: var(--gray-100);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-900);
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background-color: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background-color: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-primary {
  padding: 0.5rem 1rem;
  background-color: var(--brand-600);
  border: 1px solid transparent;
  color: var(--white);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: var(--brand-700);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--gray-500);
}

/* Footer */
footer {
  border-top: 1px solid var(--gray-100);
  background-color: rgba(255, 255, 255, 0.7);
}

.footer-content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Responsive Design - Tablet and Desktop */
@media (min-width: 640px) {
  .container,
  .header-content,
  .main-section,
  .footer-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .main-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .site-title {
    font-size: 1.25rem;
  }

  .link-card {
    padding: 0.875rem 1rem;
  }

  .link-title {
    font-size: 1rem;
  }

  .link-desc {
    font-size: 0.875rem;
  }

  .link-button {
    padding: 0.5rem 1rem;
    min-width: 5rem;
    height: 2.25rem;
    font-size: 0.875rem;
  }
}

/* iOS momentum scrolling */
.modal-open {
  overflow: hidden;
  padding-right: var(--scrollbar-comp, 0px);
}
