:root {
  --blue: #0b5fa5;
  --blue-dark: #083f6b;
  --yellow: #f6e51c;
  --bg: #eef3f9;

  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe4ef;

  --radius: 18px;
}

/* RESET */
* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* ---------------- LOGIN ---------------- */

.login {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--blue), var(--blue-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: white;
  border-radius: 22px;
  padding: 28px 24px;
}

.login-card h2 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--blue);
  font-size: 22px;
}

.login-card input {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0 16px;
  font-size: 16px;
  margin-bottom: 16px;
}

.login-btn {
  display: block;
  height: 52px;
  line-height: 52px;
  border-radius: 14px;
  background: var(--blue);
  color: white;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

/* ---------------- FORM ---------------- */

.form {
  display: none;
  padding: 14px;
}

.form:target,
.form {
  display: block;
}

/* BRAND HEADER */
.brand-header {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  color: white;
  text-align: center;
}

.brand-header h1 {
  margin: 0;
  letter-spacing: 2px;
}

.brand-header p {
  margin: 6px 0 0;
  color: var(--yellow);
  font-weight: 600;
}

/* ---------------- CARD ---------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 18px;
}

.card h3 {
  margin: 0 0 16px;
  font-size: 16px;
  color: var(--blue);
  border-left: 5px solid var(--yellow);
  padding-left: 10px;
}

/* ---------------- FIELDS ---------------- */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.field input,
.field textarea {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0 16px;
  font-size: 16px;
}

.field textarea {
  height: auto;
  min-height: 100px;
  padding-top: 14px;
}

/* ---------------- FIELD TYPES ---------------- */

.auto input {
  background: rgba(11, 95, 165, 0.12);
}

.db input {
  background: rgba(246, 229, 28, 0.22);
}

.manual input,
.manual textarea {
  background: rgba(246, 229, 28, 0.35);
}

/* ---------------- GRID ---------------- */

.grid {
  display: flex;
  flex-direction: column;
}

/* Tablet & above */
@media (min-width: 768px) {
  .grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

/* ---------------- HOME ---------------- */

.logout-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--yellow);
  color: var(--blue);
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 14px;
  z-index: 100;
}

.upload-options {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 10px 0;
}

.upload-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  background: #f8fafc;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 16px;
  width: 120px;
  transition: all 0.3s ease;
}

.upload-item:hover {
  border-color: var(--blue);
  background: rgba(11, 95, 165, 0.05);
}

.upload-icon {
  color: var(--blue);
  margin-bottom: 8px;
}

.upload-item p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.image-preview {
  margin-top: 15px;
  position: relative;
  display: inline-block;
  width: 100%;
  text-align: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.remove-img {
  position: absolute;
  top: -10px;
  right: 10px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.inline-fetch {
  display: flex;
  gap: 12px;
}

.fetch-btn {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0 24px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.fetch-btn:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(11, 95, 165, 0.2);
}

.fetch-btn:active {
  transform: translateY(0);
}

.populated input {
  animation: flash-green 1.5s ease;
}

@keyframes flash-green {
  0% {
    background: rgba(34, 197, 94, 0.3);
  }

  100% {}
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group input {
  flex: 1;
  min-width: 0;
}

.fetched-input {
  background: rgba(246, 229, 28, 0.1) !important;
  color: #666;
  border-style: solid !important;
  pointer-events: none;
}

::placeholder {
  font-style: italic;
  opacity: 0.7;
}

/* MODAL STYLES */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  max-width: 90%;
  width: 400px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px;
}

.modal-success .modal-icon {
  background: #dcfce7;
  color: #15803d;
}

.modal-error .modal-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.modal-btn {
  margin-top: 25px;
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--blue);
  color: white;
  font-weight: 700;
  cursor: pointer;
}