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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a2e;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #666;
}

#btn-logout {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #666;
  transition: background 0.2s;
}

#btn-logout:hover {
  background: #f0f0f0;
}

/* --- Auth --- */
.auth-section {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 400px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.3rem;
  color: #1a1a2e;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#auth-form input {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

#auth-form input:focus {
  outline: none;
  border-color: #4361ee;
}

#btn-auth {
  padding: 10px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-auth:hover {
  background: #3a56d4;
}

#btn-auth:disabled {
  background: #a0b0ee;
  cursor: not-allowed;
}

.auth-error {
  color: #e53e3e;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 12px;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #666;
}

#btn-switch-auth {
  background: none;
  border: none;
  color: #4361ee;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* --- Add Bookmark Form --- */
.add-bookmark {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#bookmark-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#bookmark-form input {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

#bookmark-form input:focus {
  outline: none;
  border-color: #4361ee;
}

#input-url {
  grid-column: 1 / -1;
}

#btn-add {
  grid-column: 1 / -1;
  padding: 10px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-add:hover {
  background: #3a56d4;
}

/* --- Search --- */
.search-section {
  margin-bottom: 16px;
}

#search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s;
}

#search-input:focus {
  outline: none;
  border-color: #4361ee;
}

/* --- Bookmark List --- */
#bookmark-list {
  list-style: none;
}

.bookmark-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.bookmark-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

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

.bookmark-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
  word-break: break-word;
}

.bookmark-title a {
  color: inherit;
  text-decoration: none;
}

.bookmark-title a:hover {
  color: #4361ee;
}

.bookmark-url {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.bookmark-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  background: #e8edff;
  color: #4361ee;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.bookmark-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-edit,
.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s;
}

.btn-edit:hover {
  background: #e8edff;
}

.btn-delete:hover {
  background: #ffe8e8;
}

.empty-message {
  text-align: center;
  color: #999;
  padding: 40px 0;
  font-size: 0.95rem;
}

.empty-message.hidden {
  display: none !important;
}

/* --- Responsive --- */
@media (max-width: 500px) {
  #bookmark-form {
    grid-template-columns: 1fr;
  }

  #input-url {
    grid-column: auto;
  }

  #btn-add {
    grid-column: auto;
  }
}
