@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

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

:root {
  --navy:   #17233B;
  --accent: #1C4F7F;
  --pastel: #D3E9FF;
  --bg:     #F8FAFB;
  --white:  #FFFFFF;
  --text:   #17233B;
  --border: #D3E9FF;
  --error:  #C0392B;
  --success:#1C7F4F;
  --radius-card: 8px;
  --radius-btn:  6px;
  --shadow: 0 2px 12px rgba(23, 35, 59, 0.08);
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10vh 1.5rem 1.5rem;
}

/* Header / logo */
.header {
  margin-bottom: 2rem;
  text-align: center;
}

.header img {
  height: 40px;
  width: auto;
}

/* Card */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 520px;
}

.card h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 1.25rem;
}

/* Form elements */
.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}

.input-wrapper input:focus {
  border-color: var(--accent);
}

.input-wrapper input[readonly] {
  background: var(--bg);
  cursor: text;
}

.toggle-visibility {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  align-items: center;
  padding: 0.2rem;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-btn);
  padding: 0.65rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #163d63;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--pastel);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  min-width: 7.5rem;
}

.btn-secondary:hover {
  background: #c2def8;
}

.btn-secondary.copied,
.btn-secondary.copied:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Result section */
.result {
  display: none;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.result.visible {
  display: block;
}

.url-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.url-row input {
  flex: 1;
  min-width: 0;
  padding-right: 0.75rem;
}

.url-row .secret-value {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.expiry-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #5a6a82;
}

/* Secret display */
.secret-display {
  display: none;
  margin-top: 1rem;
}

.secret-display.visible {
  display: block;
}

.secret-value {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  word-break: break-all;
  margin-bottom: 0.5rem;
  color: var(--navy);
}

/* Error / info states */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.alert-error {
  background: #fdf0ef;
  border: 1px solid #f5c6c2;
  color: var(--error);
}

.alert-success {
  background: #edf7f2;
  border: 1px solid #b8e6ce;
  color: var(--success);
}

/* Compteur de caractères du secret */
.char-count {
  font-size: 0.8rem;
  color: var(--accent);
  text-align: right;
  margin-top: 0.35rem;
  opacity: 0.7;
}

.char-count--limit {
  color: var(--error);
  font-weight: 500;
  opacity: 1;
}

/* Spinner */
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner.active {
  display: inline-block;
}

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

/* Version badge (debug) */
.version-badge {
  position: fixed;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.7rem;
  color: #aab2c0;
  font-family: 'Outfit', sans-serif;
  user-select: none;
  pointer-events: none;
}

.version-badge.mismatch {
  color: var(--error);
  font-weight: 500;
}

@media (max-width: 560px) {
  .card {
    padding: 1.5rem 1.25rem;
  }
  .url-row {
    flex-direction: column;
  }
}
