/* RV Roof Renewal — admin UI styles */

.admin-shell {
  background: linear-gradient(135deg, #0d3b66 0%, #082a4c 100%);
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.admin-auth {
  max-width: 480px;
  margin: 0 auto;
  padding: 4rem 1.25rem 2rem;
}

.admin-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}

.admin-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}
.admin-brand img { display: inline-block; height: auto; max-width: 140px; }

.admin-card h1 {
  text-align: center;
  margin: 0 0 .35rem;
  color: #0d3b66;
  font-size: 1.6rem;
}
.admin-sub {
  text-align: center;
  color: #6b7280;
  margin: 0 0 1.5rem;
  font-size: .95rem;
}

.admin-card .field { margin-bottom: 1rem; }
.admin-card label {
  display: block; font-weight: 600; color: #0d3b66; margin-bottom: .35rem; font-size: .9rem;
}
.admin-card input[type=text],
.admin-card input[type=password],
.admin-card input[type=email],
.admin-card input[type=tel],
.admin-card input[type=file],
.admin-card textarea,
.admin-card select {
  width: 100%; padding: .75rem .9rem; font: inherit;
  border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff;
}
.admin-card input:focus, .admin-card select:focus, .admin-card textarea:focus {
  outline: none; border-color: #1d6fb8; box-shadow: 0 0 0 3px rgba(29,111,184,.18);
}

.admin-card input.code-input {
  font-size: 1.6rem;
  font-family: "Consolas", "Courier New", monospace;
  text-align: center;
  letter-spacing: .35em;
  text-transform: uppercase;
}

.admin-foot {
  font-size: .85rem; color: #6b7280;
  text-align: center; margin: 1.5rem 0 0;
  border-top: 1px solid #e5e7eb; padding-top: 1.25rem;
  line-height: 1.5;
}
.admin-back { text-align: center; margin: 1.5rem 0 0; }
.admin-back a { color: #cfd9e3; text-decoration: none; font-size: .9rem; }
.admin-back a:hover { color: #fff; }

.admin-alert {
  padding: .8rem 1rem;
  border-radius: 8px;
  font-size: .92rem;
  margin-bottom: 1.25rem;
}
.admin-alert--error  { background: #fde8e6; color: #b91c1c; border: 1px solid #fecaca; }
.admin-alert--notice { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.admin-alert--success{ background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.admin-alert--info   { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }

.admin-debug-code {
  background: #fef3c7; border: 1px dashed #f59e0b;
  padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem;
  color: #78350f;
}
.admin-debug-code strong { font-family: monospace; font-size: 1.2rem; letter-spacing: .15em; }

/* ============== Dashboard ============== */
.admin-topbar {
  background: #0d3b66; color: #fff; padding: .85rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.admin-topbar a { color: #fff; text-decoration: none; }
.admin-topbar__brand { font-weight: 700; font-size: 1.05rem; }
.admin-topbar__brand img { height: 32px; vertical-align: middle; margin-right: .5rem; }
.admin-topbar__nav { display: flex; gap: 1.25rem; align-items: center; }
.admin-topbar__nav a:hover { color: #ee964b; }
.admin-topbar__logout {
  background: rgba(255,255,255,.12); padding: .35rem .85rem; border-radius: 999px; font-size: .9rem;
}
.admin-topbar__logout:hover { background: rgba(255,255,255,.2); }

.admin-main {
  max-width: 1200px; margin: 0 auto; padding: 2rem 1.25rem;
}
.admin-main h1 { color: #0d3b66; margin: 0 0 .35rem; }
.admin-main .lede { color: #6b7280; font-size: 1rem; margin: 0 0 2rem; }

.admin-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.admin-stat {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem;
}
.admin-stat .label { color: #6b7280; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.admin-stat .value { font-size: 2rem; font-weight: 800; color: #0d3b66; line-height: 1.1; }

.admin-section {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 1.5rem; margin: 1.5rem 0;
}
.admin-section h2 { color: #0d3b66; margin: 0 0 1rem; font-size: 1.2rem; }

.admin-project-list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.admin-project {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.admin-project:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.admin-project__cover { aspect-ratio: 4/3; background: #e5e7eb center/cover; }
.admin-project__body { padding: 1rem; }
.admin-project__title { font-weight: 700; color: #0d3b66; margin: 0 0 .25rem; }
.admin-project__meta { font-size: .85rem; color: #6b7280; }
.admin-project__counts { font-size: .8rem; color: #6b7280; margin-top: .35rem; }

.admin-photo-stage { margin-bottom: 1.5rem; }
.admin-photo-stage h3 {
  color: #0d3b66; margin: 0 0 .75rem;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-photo-stage .count { font-size: .85rem; color: #6b7280; font-weight: 400; }

.admin-photo-grid {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.admin-photo {
  background: #f6f8fb; border: 3px solid transparent; border-radius: 10px; overflow: hidden;
  position: relative;
  transition: border-color .15s, transform .12s;
}
.admin-photo.is-cover {
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22,163,74,.18);
}
.admin-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.admin-photo__caption {
  padding: .5rem; font-size: .8rem; color: #404040;
  border-top: 1px solid #e5e7eb;
}
.admin-photo__caption input {
  width: 100%; border: 0; background: transparent; padding: 0; font-size: .82rem; color: #1a1a1a;
}
.admin-photo__delete {
  position: absolute; top: .35rem; right: .35rem;
  background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 1rem;
  z-index: 2;
}
.admin-photo__delete:hover { background: #b91c1c; }

.admin-photo__star {
  position: absolute; top: .35rem; left: .35rem;
  background: rgba(0,0,0,.6); color: #fff; text-decoration: none;
  border: 0; border-radius: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background .15s, color .15s, transform .12s;
  z-index: 2;
}
.admin-photo__star:hover  { background: #f59e0b; color: #fff; transform: scale(1.08); }
.admin-photo__star.is-cover { background: #16a34a; color: #fff; }

.admin-photo__cover-badge {
  position: absolute; bottom: 38px; left: .35rem;
  background: #16a34a; color: #fff;
  font-size: .7rem; font-weight: 800;
  padding: .15rem .5rem; border-radius: 4px;
  letter-spacing: .04em;
  z-index: 2;
}

.admin-upload-zone {
  border: 2px dashed #cbd5e1; border-radius: 10px;
  padding: 1.25rem; text-align: center; background: #f6f8fb;
  font-size: .9rem; color: #6b7280;
}
.admin-upload-zone input[type=file] { margin-top: .5rem; }

/* ============== Bulk upload (3-column drag-and-drop) ============== */
.bulk-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .bulk-stage-grid { grid-template-columns: 1fr; }
}

.bulk-stage {
  --stage-color: #0d3b66;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
  display: flex; flex-direction: column;
  min-height: 260px;
}
.bulk-stage__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
  padding-bottom: .65rem;
  border-bottom: 2px solid var(--stage-color);
}
.bulk-stage__head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .04em;
}
.bulk-stage__count {
  font-size: .78rem; color: #6b7280;
  background: #f6f8fb;
  padding: .15rem .55rem;
  border-radius: 999px;
}

.bulk-dropzone {
  border: 3px dashed #cbd5e1;
  border-radius: 12px;
  padding: 1.25rem .75rem;
  text-align: center;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
  flex: 0 0 auto;
}
.bulk-dropzone:hover,
.bulk-dropzone:focus {
  border-color: var(--stage-color);
  background: #fff;
  outline: none;
}
.bulk-dropzone.is-dragging {
  border-color: var(--stage-color);
  background: #fff8e6;
  transform: scale(1.02);
  border-style: solid;
}
.bulk-dropzone__hint {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
}
.bulk-dropzone__icon {
  font-size: 2.4rem; line-height: 1;
}
.bulk-dropzone strong {
  color: var(--stage-color);
  font-size: 1rem;
}

.bulk-preview-grid {
  display: grid;
  gap: .55rem;
  grid-template-columns: 1fr 1fr;
  margin-top: .85rem;
}
.bulk-preview {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  overflow: hidden; position: relative;
  display: flex; flex-direction: column;
}
.bulk-preview img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block;
}
.bulk-preview__remove {
  position: absolute; top: .25rem; right: .25rem;
  background: rgba(0,0,0,.7); color: #fff; border: 0; border-radius: 6px;
  width: 24px; height: 24px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.bulk-preview__remove:hover { background: #b91c1c; }
.bulk-preview__caption {
  border: 0; border-top: 1px solid #e5e7eb;
  padding: .45rem .5rem; font-size: .8rem; width: 100%;
  background: #fff;
}
.bulk-preview__caption:focus { outline: none; background: #eef6ff; }
.bulk-preview__meta {
  font-size: .68rem; color: #9ca3af;
  padding: 0 .5rem .45rem; line-height: 1.3;
}

/* ============== Invoice / Estimate editor ============== */
.admin-section .field { margin-bottom: 1rem; }
.admin-section label {
  display: block; font-weight: 600; color: #0d3b66; margin-bottom: .35rem; font-size: .9rem;
}
.admin-section input[type=text],
.admin-section input[type=email],
.admin-section input[type=tel],
.admin-section input[type=number],
.admin-section input[type=date],
.admin-section textarea,
.admin-section select {
  width: 100%; padding: .55rem .7rem; font: inherit;
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
}
.admin-section input:focus, .admin-section select:focus, .admin-section textarea:focus {
  outline: none; border-color: #1d6fb8; box-shadow: 0 0 0 3px rgba(29,111,184,.15);
}

.inv-editor-table {
  width: 100%; border-collapse: collapse;
}
.inv-editor-table thead th {
  background: #f6f8fb; color: #6b7280;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .55rem .5rem; text-align: left; font-weight: 700;
  border-bottom: 2px solid #e5e7eb;
}
.inv-editor-table tbody td {
  padding: .35rem .35rem; border-bottom: 1px solid #f1f3f7;
  vertical-align: middle;
}
.inv-editor-table input,
.inv-editor-table select {
  width: 100%; padding: .45rem .55rem; font: inherit;
  border: 1px solid transparent; border-radius: 6px; background: #fff;
}
.inv-editor-table input:hover,
.inv-editor-table select:hover { border-color: #e5e7eb; }
.inv-editor-table input:focus,
.inv-editor-table select:focus {
  border-color: #1d6fb8; outline: none;
  box-shadow: 0 0 0 2px rgba(29,111,184,.18);
  background: #fff;
}

.inv-remove-row {
  background: transparent; color: #b91c1c; border: 0;
  font-size: 1.25rem; line-height: 1; cursor: pointer;
  padding: .15rem .4rem; border-radius: 6px;
  transition: background .15s;
}
.inv-remove-row:hover { background: #fee2e2; }

.inv-totals {
  width: 100%; border-collapse: collapse;
  background: #f6f8fb; border-radius: 10px; padding: 1rem;
}
.inv-totals td {
  padding: .55rem .85rem;
  font-size: .95rem;
  border-top: 1px solid #e5e7eb;
}
.inv-totals tr:first-child td { border-top: 0; }

/* Buttons in admin */
.btn { display: inline-block; text-decoration: none; padding: .55rem 1rem;
       border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; border: 0; }
.btn--primary { background: #ee964b; color: #fff; }
.btn--primary:hover { background: #d97706; }
.btn--ghost { background: #fff; color: #0d3b66; border: 1px solid #d1d5db; }
.btn--ghost:hover { background: #f6f8fb; border-color: #0d3b66; }

/* Mobile */
@media (max-width: 700px) {
  .admin-topbar__nav { gap: .75rem; flex-wrap: wrap; }
  .admin-card { padding: 1.5rem 1.25rem; }
  .admin-photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .inv-editor-table { font-size: .82rem; }
  .inv-editor-table input,
  .inv-editor-table select { padding: .35rem .4rem; }
}
