/* ================================================================
   LinkKosh Web Clipper — Styles
   Brand: Coral (#FF6B6B), Teal (#4ECDC4), Gold (#FFD93D)
   Font:  Inter (Google Fonts)
   ================================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #FAFAFA;
  color: #1A1A1A;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Container ────────────────────────────────────────────── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icon-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  filter: drop-shadow(0 2px 4px rgba(255, 107, 107, 0.3));
}

.logo-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(255, 107, 107, 0.3));
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A1A;
  line-height: 1.2;
}

.logo-kosh {
  color: #FFD93D;
}

.logo-sub {
  font-weight: 500;
  color: #6B6B6B;
  font-size: 16px;
}

.tagline {
  font-size: 14px;
  color: #6B6B6B;
  text-align: left;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 14px;
  color: #6B6B6B;
  margin-bottom: 16px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #FF6B6B, #E85555);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #E85555, #D04545);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.btn-google {
  background: #FFFFFF;
  color: #4A4A4A;
  border: 1px solid #E0E0E0;
}

.btn-google:hover {
  background: #F5F5F5;
  border-color: #CCC;
}

.google-icon {
  flex-shrink: 0;
}

.btn-full {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: #FF6B6B;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-link:hover {
  background: rgba(255, 107, 107, 0.08);
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: #9B9B9B;
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #E0E0E0;
}

.divider span {
  padding: 0 12px;
}

/* ── Form Elements ────────────────────────────────────────── */
.label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #4A4A4A;
  margin-bottom: 6px;
  margin-top: 14px;
}

.label:first-of-type {
  margin-top: 0;
}

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  color: #1A1A1A;
  background: #FAFAFA;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: #4ECDC4;
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.15);
  background: #FFFFFF;
}

.input::placeholder {
  color: #9B9B9B;
}

.input.input-error {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B6B6B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Field Error ──────────────────────────────────────────── */
.field-error {
  font-size: 13px;
  color: #EF4444;
  margin-top: 4px;
  padding-left: 2px;
}

/* ── Info Box ─────────────────────────────────────────────── */
.info-box {
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 13px;
  color: #0369A1;
  line-height: 1.6;
}

.info-box p {
  margin-bottom: 4px;
}

.info-box ul {
  list-style: none;
  padding: 0;
}

.info-box li::before {
  content: "\2022";
  color: #4ECDC4;
  font-weight: bold;
  display: inline-block;
  width: 14px;
}

/* ── Group Selection ──────────────────────────────────────── */
.group-selection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.radio-option:hover {
  border-color: #4ECDC4;
  background: rgba(78, 205, 196, 0.04);
}

.radio-option input[type="radio"] {
  accent-color: #4ECDC4;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.radio-option input[type="radio"]:checked ~ .radio-content .group-name,
.radio-option input[type="radio"]:checked + span {
  color: #1A1A1A;
  font-weight: 500;
}

.radio-content {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.group-banner {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #F0F0F0;
}

.group-banner-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #B2DFDB;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00695C;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-links-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #FFCDD2;
  color: #E53935;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Category Select with emoji ──────────────────────────── */
.category-select-wrapper {
  position: relative;
}

/* ── Save Button Wrapper ──────────────────────────────────── */
.save-btn-wrapper {
  margin-top: 20px;
}

.close-after-save-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #6B6B6B;
  cursor: pointer;
}

.close-after-save-label input[type="checkbox"] {
  accent-color: #4ECDC4;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Status Messages ──────────────────────────────────────── */
.status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

.status-success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.status-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.status-loading {
  background: #FFF7ED;
  color: #92400E;
  border: 1px solid #FED7AA;
}

/* ── User Bar ─────────────────────────────────────────────── */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #FFFFFF;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #FF6B6B, #E85555);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-letter {
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-email {
  font-size: 14px;
  color: #4A4A4A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* ── Bookmarklet (collapsible) ────────────────────────────── */
.bookmarklet-details {
  padding: 0;
}

.bookmarklet-summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.bookmarklet-summary::-webkit-details-marker {
  display: none;
}

.bookmarklet-summary::after {
  content: "\25B6";
  font-size: 12px;
  color: #999;
  transition: transform 0.2s ease;
}

.bookmarklet-details[open] > .bookmarklet-summary {
  margin-bottom: 8px;
}

.bookmarklet-details[open] > .bookmarklet-summary::after {
  transform: rotate(90deg);
}

.bookmarklet-details > :not(summary) {
  padding: 0 24px;
}

.bookmarklet-details > :last-child {
  padding-bottom: 24px;
}

/* ── Bookmarklet content ─────────────────────────────────── */
.bookmarklet-container {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.bookmarklet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #FFD93D, #F5C800);
  color: #1A1A1A;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(255, 217, 61, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bookmarklet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 217, 61, 0.4);
}

.bookmarklet-btn:active {
  cursor: grabbing;
}

.bookmarklet-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

/* ── Recent Clips ─────────────────────────────────────────── */
.clip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F0F0F0;
  font-size: 14px;
}

.clip-item:last-child {
  border-bottom: none;
}

.clip-url {
  color: #4A4A4A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.clip-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.clip-status-pending {
  background: #FFF7ED;
  color: #92400E;
}

.clip-status-synced {
  background: #ECFDF5;
  color: #065F46;
}

.clip-status-failed {
  background: #FEF2F2;
  color: #991B1B;
}

/* ── Hint ─────────────────────────────────────────────────── */
.hint {
  font-size: 13px;
  color: #9B9B9B;
  margin-top: 8px;
}

.auth-note {
  font-size: 13px;
  color: #9B9B9B;
  margin-top: 14px;
  text-align: center;
}

/* ── Auth Loading Splash ─────────────────────────────────── */
.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #E0E0E0;
  border-top-color: #4ECDC4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: #6B6B6B;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px 0 8px;
  font-size: 13px;
  color: #9B9B9B;
}

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

.footer a:hover {
  text-decoration: underline;
}

/* ── Pro Gate ─────────────────────────────────────────────── */
.pro-gate {
  text-align: center;
  padding: 32px 24px;
}

.pro-gate-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.pro-features {
  text-align: left;
  margin: 16px auto;
  max-width: 280px;
}

.pro-feature-item {
  font-size: 14px;
  color: #4A4A4A;
  padding: 6px 0;
  line-height: 1.4;
}

.pro-feature-item::first-letter {
  color: #4ECDC4;
  font-weight: 700;
}

.pro-gate-cta {
  font-size: 15px;
  font-weight: 600;
  color: #FF6B6B;
  margin-top: 16px;
  padding: 12px 20px;
  background: rgba(255, 107, 107, 0.08);
  border-radius: 10px;
}

/* ── Utilities ────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 520px) {
  .container {
    padding: 16px 12px;
  }

  .card {
    padding: 18px;
    border-radius: 12px;
  }

  .clip-url {
    max-width: 200px;
  }

  .user-email {
    max-width: 180px;
  }
}
