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

body {
  font-family: 'Inter', sans-serif;
  background-color: #0f0f0f;
  color: #e8e8e8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Card container ---- */
.card {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  position: relative;
}

/* ---- Heading ---- */

h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-top: 24px;
  margin-bottom: 6px;
  color: #19bd52;
  text-align: center;
}
.subtitle {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin-bottom: 32px;
}

p {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 24px;
}

/* ---- URL Input ---- */

#urlInput {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  background-color: #242424;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #e8e8e8;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#urlInput::placeholder {
  color: #555;
}

#urlInput:focus {
  border-color: #19bd52;
  box-shadow: 0 0 0 3px rgba(25, 189, 82, 0.1);
}

/* ---- Button ---- */
button {
  margin-top: 12px;
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background-color: #19bd52;
  color: #0a0a0a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}

button:hover {
  background-color: #15a847;
}

button:active {
  transform: scale(0.99);
}

button:disabled {
  background-color: #1a4a2e;
  color: #555;
  cursor: not-allowed;
  transform: none;
}

/* ---- Loading state ---- */
#loading {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
   color: #666;
  margin-bottom: 0;
}

/* ---- Result area ---- */

#result {
  margin-top: 24px;
  background-color: #1e1e1e;
  border-radius: 8px;
  padding: 24px;
  border-left: 3px solid #19bd52;
}

#result p {
  color: #d4d4d4;
  line-height: 1.8;
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 0;
}

/* ---- Result header ---- */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #19bd52;
}

#copyBtn {
  width: auto;
  margin-top: 0;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  background-color: transparent;
  color: #19bd52;
  border: 1px solid #19bd52;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  letter-spacing: 0;
}

#copyBtn:hover {
  background-color: #19bd52;
  color: #0a0a0a;
}

.word-count {
  display: block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: #555;
}

/* ---- History ---- */
#history {
  margin-top: 28px;
}

.history-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  margin-bottom: 10px;
}

#historyList {
  list-style: none;
}

.history-item {
  padding: 12px;
  border-radius: 8px;
  background-color: #1e1e1e;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item:hover {
  background-color: #252525;
}

.history-url {
  font-size: 0.8rem;
  font-weight: 600;
  color: #19bd52;
}

.history-preview {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.4;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {

  body {
    align-items: flex-start;
    padding: 24px 16px;
  }

  .card {
    padding: 28px 20px;
    border-radius: 8px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.85rem;
    margin-bottom: 24px;
  }

  #urlInput {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  button {
    padding: 13px;
    font-size: 0.9rem;
  }

  #result {
    padding: 18px;
  }

  #result p {
    font-size: 0.95rem;
    line-height: 1.7;
  }

}

/* ---- Animation on result ---- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#result.visible {
  animation: fadeIn 0.3s ease forwards;
}

#history {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #2a2a2a;
}

/* ---- Topbar ---- */
.topbar {
  position: absolute;
  top: 20px;
  right: 40px;
  min-height: unset;
  margin-bottom: 0;
  padding-bottom: 0;
}
#userInfo {
  display: flex;
  align-items: center;
  gap: 10px;
}

#userEmail {
  font-size: 0.8rem;
  color: #555;
}

#signInTrigger {
  width: auto;
  margin-top: 0;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  color: #19bd52;
  border: 1px solid #19bd52;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  letter-spacing: 0;
}

#signInTrigger:hover {
  background-color: #19bd52;
  color: #0a0a0a;
}

#signOutBtn {
  width: auto;
  margin-top: 0;
  padding: 5px 12px;
  font-size: 0.8rem;
  letter-spacing: 0;
}

/* ---- Auth forms ---- */
#authForms {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

#emailInput,
#passwordInput {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  background-color: #242424;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: #e8e8e8;
  outline: none;
  transition: border-color 0.2s;
}

#emailInput:focus,
#passwordInput:focus {
  border-color: #19bd52;
}

.auth-buttons {
  display: flex;
  gap: 10px;
}

.auth-buttons button {
  margin-top: 0;
  flex: 1;
}

.auth-error {
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* ---- Save hint ---- */
.save-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: #444;
  text-align: center;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #19bd52;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}