:root {
  --black: #090909;
  --black-soft: #151515;
  --gold: #c9a44c;
  --gold-light: #e4c875;
  --white: #ffffff;
  --paper: #f6f4ef;
  --gray: #6f6f6f;
  --border: #dedbd3;
  --error: #9e2f2f;
  --error-background: #fff0f0;
  --success: #27633c;
  --success-background: #edf8f0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at top right,
      rgba(201, 164, 76, 0.18),
      transparent 35%
    ),
    linear-gradient(145deg, #050505, #171717);
  color: var(--black);
  font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.admin-container {
  width: min(100%, 980px);
  padding: 48px;
  border-top: 5px solid var(--gold);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

.back-link {
  display: block;
  width: min(100%, 560px);
  margin: 0 auto 36px;
  color: var(--gray);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition:
    color 180ms ease,
    transform 180ms ease;
}

.back-link:hover {
  color: var(--gold);
  transform: translateX(-3px);
}

.admin-header {
  width: min(100%, 560px);
  margin: 0 auto 34px;
  text-align: center;
}

.brand-name {
  margin: 0;
  color: var(--gold);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-description {
  margin: 5px 0 38px;
  color: var(--gray);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.admin-header h1 {
  margin: 0 0 12px;
  font-size: clamp(29px, 5vw, 42px);
  line-height: 1.08;
}

.admin-header > p:last-child {
  margin: 0;
  color: var(--gray);
  line-height: 1.6;
}

.admin-form {
  display: grid;
  width: min(100%, 560px);
  margin: 0 auto;
  gap: 20px;
}

.form-group {
  display: grid;
  gap: 9px;
}

.form-group label {
  font-size: 14px;
  font-weight: 750;
}

.form-group input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--paper);
  color: var(--black);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.form-group input:hover {
  border-color: #b9b5aa;
}

.form-group input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(201, 164, 76, 0.16);
}

.otp-input {
  text-align: center;
  font-size: 25px !important;
  font-weight: 800;
  letter-spacing: 0.45em;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 52px;
  border-radius: 10px;
  font-weight: 800;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  border: 1px solid var(--black);
  background: var(--black);
  color: var(--white);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--black);
  transform: translateY(-2px);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--black);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--gold);
  background: #fffaf0;
}

.text-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--gray);
  font-size: 14px;
  text-decoration: underline;
}

.text-button:hover:not(:disabled) {
  color: var(--black);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.global-message {
  width: min(100%, 560px);
  margin: 0 auto 24px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.global-message.info {
  border-color: #d8c68f;
  background: #fff9e8;
  color: #65511d;
}

.global-message.success {
  border-color: #a8d5b4;
  background: var(--success-background);
  color: var(--success);
}

.global-message.error {
  border-color: #e6b8b8;
  background: var(--error-background);
  color: var(--error);
}

.verification-heading {
  margin-bottom: 4px;
  text-align: center;
}

.verification-label,
.dashboard-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.verification-heading h2 {
  margin: 0 0 10px;
  font-size: 27px;
}

.verification-heading > p:last-child {
  margin: 0;
  color: var(--gray);
  line-height: 1.6;
}

.owner-dashboard {
  width: 100%;
}

.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.dashboard-heading h2 {
  margin: 0;
  font-size: clamp(25px, 4vw, 34px);
}

.logout-button {
  min-width: 150px;
  padding: 0 18px;
}

.dashboard-welcome {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid #cbe0d1;
  border-radius: 12px;
  background: var(--success-background);
}

.dashboard-welcome p {
  margin: 6px 0 0;
  color: var(--success);
  line-height: 1.5;
}

.status-indicator {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  background: #3ca35b;
  box-shadow: 0 0 0 5px rgba(60, 163, 91, 0.14);
}

.dashboard-placeholder {
  padding: 44px 24px;
  border: 1px dashed #c9c5bc;
  border-radius: 14px;
  background: var(--paper);
  text-align: center;
}

.dashboard-placeholder p {
  margin: 0 0 8px;
  font-weight: 800;
}

.dashboard-placeholder small {
  color: var(--gray);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .admin-page {
    align-items: flex-start;
    padding: 18px 12px;
  }

  .admin-container {
    min-height: calc(100vh - 36px);
    padding: 30px 20px;
    border-radius: 14px;
  }

  .back-link {
    margin-bottom: 30px;
  }

  .brand-description {
    margin-bottom: 30px;
  }

  .admin-header {
    margin-bottom: 28px;
  }

  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .logout-button {
    width: 100%;
  }

  .otp-input {
    letter-spacing: 0.32em;
  }
}

/* =========================================
   ADMINISTRADOR DE PROPIEDADES
========================================= */

.property-manager {
  width: 100%;
  margin-top: 34px;
}

.manager-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.manager-toolbar h3 {
  margin: 0 0 6px;
  font-size: 26px;
}

.manager-toolbar p {
  margin: 0;
  color: var(--gray);
}

.manager-actions {
  display: flex;
  gap: 10px;
}

.toolbar-button {
  min-width: 135px;
  padding: 0 18px;
}

.admin-summary {
  display: grid;
  margin-bottom: 28px;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.admin-summary article {
  display: grid;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  gap: 5px;
}

.admin-summary strong {
  color: var(--gold);
  font-size: 28px;
}

.admin-summary span {
  color: var(--gray);
  font-size: 13px;
  font-weight: 700;
}

/* EDITOR */

.property-editor {
  margin-bottom: 30px;
  padding: 28px;
  border: 1px solid #d8c68f;
  border-radius: 16px;
  background: #fffcf4;
}

.editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e4dcc7;
}

.editor-heading h3 {
  margin: 0;
  font-size: 26px;
}

.property-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.full-field {
  grid-column: 1 / -1;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--paper);
  color: var(--black);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.form-group select {
  height: 54px;
}

.form-group textarea {
  min-height: 220px;
  line-height: 1.65;
  resize: vertical;
}

.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(201, 164, 76, 0.16);
}

.published-control {
  display: flex;
  min-height: 54px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 750;
  gap: 11px;
}

.published-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.file-input {
  height: auto !important;
  padding: 12px !important;
  background: var(--white) !important;
}

.file-input::file-selector-button {
  margin-right: 14px;
  padding: 10px 14px;
  border: 0;
  border-radius: 7px;
  background: var(--black);
  color: var(--white);
  font-weight: 750;
  cursor: pointer;
}

.field-help {
  color: var(--gray);
  line-height: 1.5;
}

/* FOTOGRAFÍAS EXISTENTES */

.existing-images {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.existing-image {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
}

.existing-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.remove-existing-image {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.78);
  color: var(--white);
  font-size: 17px;
  font-weight: 800;
}

.empty-images {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  border: 1px dashed #c9c5bc;
  border-radius: 10px;
  color: var(--gray);
  text-align: center;
}

.upload-progress {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid #d8c68f;
  border-radius: 9px;
  background: #fff8e4;
  color: #65511d;
  font-size: 14px;
  font-weight: 700;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 26px;
  gap: 12px;
}

.editor-actions button {
  min-width: 170px;
  padding: 0 20px;
}

/* LISTADO DE PUBLICACIONES */

.admin-list-message {
  min-height: 22px;
  margin-bottom: 12px;
  color: var(--gray);
  font-size: 14px;
  font-weight: 650;
}

.admin-properties-list {
  display: grid;
  gap: 16px;
}

.admin-property-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  grid-template-columns: 230px minmax(0, 1fr);
}

.admin-card-image {
  position: relative;
  min-height: 230px;
  background: #e9e6df;
}

.admin-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card-image .no-image {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 230px;
  place-items: center;
  padding: 20px;
  color: var(--gray);
  text-align: center;
}

.admin-card-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 22px;
}

.admin-card-tags {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 12px;
  gap: 7px;
}

.admin-card-tags span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-card-tags .status-disponible {
  background: #e9f6ed;
  color: #27633c;
}

.admin-card-tags .status-vendida,
.admin-card-tags .status-rentada {
  background: #fff1d0;
  color: #6b5217;
}

.admin-card-tags .not-published {
  background: #ececec;
  color: #555;
}

.admin-card-content h4 {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.25;
}

.admin-card-location {
  margin: 0 0 12px;
  color: var(--gray);
  font-size: 14px;
}

.admin-card-price {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 22px;
  font-weight: 850;
}

.admin-card-facts {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 18px;
  color: var(--gray);
  font-size: 13px;
  gap: 12px;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: auto;
  gap: 8px;
}

.admin-card-actions button,
.admin-card-actions select {
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--white);
  color: var(--black);
  font-size: 12px;
  font-weight: 750;
}

.admin-card-actions button:hover {
  border-color: var(--gold);
  background: #fffaf0;
}

.admin-card-actions .delete-property-button {
  border-color: #e3b4b4;
  color: var(--error);
}

.admin-card-actions .delete-property-button:hover {
  background: var(--error-background);
}

.admin-empty-state {
  padding: 50px 24px;
  border: 1px dashed #c9c5bc;
  border-radius: 14px;
  background: var(--paper);
  color: var(--gray);
  text-align: center;
}

/* RESPONSIVE */

@media (max-width: 760px) {
  .manager-toolbar,
  .editor-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .manager-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-button {
    min-width: 0;
  }

  .admin-summary {
    grid-template-columns: 1fr;
  }

  .property-editor {
    padding: 20px 16px;
  }

  .property-form-grid {
    grid-template-columns: 1fr;
  }

  .full-field {
    grid-column: auto;
  }

  .published-control {
    grid-column: auto;
  }

  .existing-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-actions {
    flex-direction: column;
  }

  .editor-actions button {
    width: 100%;
  }

  .admin-property-card {
    grid-template-columns: 1fr;
  }

  .admin-card-image {
    min-height: 220px;
    max-height: 300px;
  }
}

@media (max-width: 430px) {
  .manager-actions {
    grid-template-columns: 1fr;
  }

  .existing-images {
    grid-template-columns: 1fr;
  }
}
