/* Gestionnaire d'alias email : mobile-first, sobre, sans framework. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.45;
}

.app {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem;
}

.screen[hidden] {
  display: none;
}

.screen-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

p {
  margin: 0 0 0.5rem;
  color: #444;
}

label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: #444;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  color: #1a1a1a;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  width: 100%;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-ghost {
  background: transparent;
  color: #444;
  border: 1px solid #ccc;
}

.btn-ghost:hover {
  background: #eee;
}

.btn-icon {
  background: transparent;
  border: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.btn-icon:hover {
  background: #eee;
}

.error-message {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.empty-message {
  color: #666;
  text-align: center;
  margin-top: 2rem;
}

.topbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.topbar select {
  flex: 1;
  min-width: 160px;
}

.create-form {
  margin-bottom: 1rem;
  max-width: none;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field {
  flex: 1;
}

.input-suffix {
  display: flex;
  align-items: stretch;
}

.input-suffix input {
  border-radius: 6px 0 0 6px;
}

.suffix {
  padding: 0 0.75rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 6px 6px 0;
  color: #666;
  white-space: nowrap;
}

.field-row-actions {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0;
}

.checkbox input {
  width: auto;
  min-height: 0;
}

.field-row-actions .btn {
  margin-top: 0;
  width: auto;
  padding: 0 1.5rem;
}

.search-row {
  margin-bottom: 1rem;
}

.redirections-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.redirection-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.redirection-info {
  flex: 1;
  min-width: 180px;
  word-break: break-word;
}

.redirection-from {
  font-weight: 600;
}

.redirection-arrow {
  color: #999;
  margin: 0 0.35rem;
}

.redirection-to {
  color: #444;
}

.redirection-actions {
  display: flex;
  gap: 0.15rem;
  margin-left: auto;
}

.redirection-item.editing {
  flex-direction: column;
  align-items: stretch;
}

.edit-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.edit-actions .btn {
  margin-top: 0;
  width: auto;
  padding: 0 1.25rem;
}

.spinner {
  width: 24px;
  height: 24px;
  margin: 1rem auto;
  border: 3px solid #ddd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}

.toast.visible {
  opacity: 1;
}

.toast.toast-error {
  background: #dc2626;
}

@media (min-width: 480px) {
  .field-row {
    flex-direction: row;
  }
}
