/* ============ LinkDash — Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ebebeb;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #8a8a8a;
  --accent: #2563eb;
  --danger: #e11d48;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

body {
  font-family: 'Segoe UI', 'Hind Siliguri', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ============ Top bar ============ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px 0;
}
.brand {
  display: flex;
  align-items: center;
}
.brand img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  padding: 6px 10px;
  border-radius: 999px;
}
.profile-chip img,
.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #dcdcdc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #666;
}
.profile-chip .name { font-weight: 600; }

/* ============ Search ============ */
.search-wrap {
  max-width: 560px;
  margin: 28px auto 36px;
  padding: 0 20px;
}
.search-box {
  position: relative;
  width: 100%;
}
.search-box input {
  width: 100%;
  padding: 14px 46px 14px 20px;
  border: none;
  border-radius: 999px;
  background: #fff;
  font-size: 16px;
  color: #333;
  box-shadow: var(--shadow);
}
.search-box input::placeholder { color: #b3b3b3; }
.search-box .icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #b3b3b3;
}

/* ============ Grid ============ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 40px 60px; }

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.site-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.site-card .logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #f2f2f2;
}

.site-card .name {
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.star-btn {
  position: absolute;
  top: 6px;
  left: 8px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #d8d8d8;
  line-height: 1;
  padding: 2px;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, transform .15s ease;
}
.site-card:hover .star-btn { opacity: 1; }
.star-btn.active { color: #f5b301; opacity: 1; }
.star-btn:hover { transform: scale(1.15); }
.site-card.is-favorite { box-shadow: 0 0 0 1.5px #f5b30155, var(--shadow); }

.site-card .card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 6px;
}
.site-card:hover .card-actions { display: flex; }
.card-actions button {
  border: none;
  background: rgba(0,0,0,0.06);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-actions button:hover { background: rgba(0,0,0,0.12); }

.add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 80px;
  font-size: 28px;
  color: #444;
  border: none;
  width: 100%;
}
.add-card:hover { box-shadow: var(--shadow-lg); }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 18px; font-size: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; color: #555; font-weight: 600; }
.field input[type="text"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #f2f2f2;
  border: 1px dashed #ccc;
}
.file-btn {
  display: inline-block;
  padding: 9px 16px;
  background: #f1f1f1;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.file-btn input { display: none; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #f1f1f1; color: #333; }
.btn-secondary:hover { background: #e6e6e6; }
.btn-danger { background: var(--danger); color: #fff; }

.form-error {
  background: #fdecea;
  color: #b3261e;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}
.form-success {
  background: #eafbea;
  color: #1e7d32;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ============ Auth pages ============ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-box {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
}
.auth-box h1 {
  font-size: 22px;
  margin-bottom: 4px;
  text-align: center;
}
.auth-box p.sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 22px;
}
.auth-box .btn { width: 100%; padding: 13px; }
.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}
.auth-switch a { color: var(--accent); font-weight: 700; }

/* ============ Profile page ============ */
.profile-card {
  max-width: 480px;
  margin: 40px auto;
  background: #fff;
  border-radius: 16px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.profile-photo-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}
.profile-photo-row .avatar-circle,
.profile-photo-row img.avatar-circle {
  width: 78px;
  height: 78px;
  font-size: 26px;
}
.back-link {
  display: inline-block;
  margin: 24px 0 0 40px;
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 480px) {
  .topbar, .container { padding-left: 18px; padding-right: 18px; }
  .site-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .site-card { padding: 12px; gap: 10px; }
  .site-card .name { font-size: 14px; }
}