/* ============================================================================
   Marena Bornas Inmobiliaria — Shared Styles
   Paleta: #184D59 (navy) · #68868C (slate) · #D96704 (orange) · #F2B077 (peach) · #F2F2F2 (bg)
   Mobile-first. Sin frameworks.
   ============================================================================ */

:root{
  --navy:        #184D59;
  --navy-dark:   #0F343C;
  --slate:       #68868C;
  --slate-light: #A0B4B8;
  --orange:      #D96704;
  --orange-dark: #B25303;
  --peach:       #F2B077;
  --peach-light: #FCE4CF;
  --bg:          #F2F2F2;
  --card:        #FFFFFF;
  --border:      #E2E5E8;
  --text:        #1B2A30;
  --muted:       #6B7B82;

  --green:  #16A34A;
  --yellow: #EAB308;
  --red:    #DC2626;
  --blue:   #2563EB;

  --shadow-sm: 0 1px 2px rgba(15,52,60,.05);
  --shadow:    0 4px 14px rgba(15,52,60,.08);
  --shadow-lg: 0 10px 30px rgba(15,52,60,.15);
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
}

*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
a{color: var(--orange); text-decoration:none}
a:hover{text-decoration:underline}

/* ===== Navbar ===== */
.nav{
  position: sticky; top:0; z-index:100;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display:flex; align-items:center; justify-content:space-between;
  box-shadow: var(--shadow);
}
.nav-left{display:flex; align-items:center; gap:14px}
.nav-brand{
  font-size: 17px; font-weight: 800; letter-spacing: -.2px;
  color: #fff; display:flex; gap:8px; align-items:center;
}
.nav-brand .dot{
  width:10px;height:10px;border-radius:50%; background: var(--orange);
  box-shadow: 0 0 0 4px rgba(217,103,4,.25);
}
.nav-brand small{font-weight:500; color: var(--peach); font-size:11px; text-transform:uppercase; letter-spacing:1.2px}
.nav-links{display:flex; gap:6px; align-items:center; flex-wrap:wrap}
.nav-link{
  color: rgba(255,255,255,.7);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-weight:500; font-size:13px;
  transition: all .15s; cursor:pointer; border:none; background:transparent;
  font-family:inherit;
}
.nav-link:hover{color:#fff; background: rgba(255,255,255,.08); text-decoration:none}
.nav-link.active{color: var(--navy); background:#fff}
.nav-user{display:flex; gap:8px; align-items:center; font-size:12px; color: rgba(255,255,255,.85)}
.nav-user .avatar{
  width:30px; height:30px; border-radius:50%;
  background: var(--orange); color:#fff; font-weight:700;
  display:flex; align-items:center; justify-content:center; font-size:12px;
}
.nav-link{position:relative}

/* ===== Layout ===== */
.main{padding: 20px; max-width: 1400px; margin: 0 auto}
.page-header{
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  display:flex; flex-wrap:wrap; gap:14px; align-items:center; justify-content:space-between;
}
.page-header h2{font-size: 22px; font-weight:700; margin-bottom: 4px}
.page-header p{font-size: 13px; color: rgba(255,255,255,.78); max-width:700px}
.page-header .actions{display:flex; gap:8px; flex-wrap:wrap}

/* ===== Cards ===== */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title{
  font-size: 14px; font-weight:700; margin-bottom: 14px;
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.card-title .badge{font-size:11px; padding: 3px 8px; background: var(--bg); border-radius: 20px; color: var(--muted); font-weight:600}

/* ===== Grid ===== */
.grid{display:grid; gap:16px}
.grid-2{grid-template-columns: repeat(2, 1fr)}
.grid-3{grid-template-columns: repeat(3, 1fr)}
.grid-4{grid-template-columns: repeat(4, 1fr)}
@media (max-width: 900px){
  .grid-3, .grid-4 {grid-template-columns: repeat(2, 1fr)}
}
@media (max-width: 600px){
  .grid-2, .grid-3, .grid-4 {grid-template-columns: 1fr}
}

/* ===== KPIs ===== */
.kpi{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.kpi .label{font-size: 11px; text-transform: uppercase; letter-spacing:1px; color: var(--muted); font-weight:700; margin-bottom:8px}
.kpi .value{font-size: 28px; font-weight: 800; color: var(--navy); line-height:1.1}
.kpi .delta{font-size: 12px; color: var(--muted); margin-top:6px}
.kpi.accent{background: linear-gradient(135deg, var(--orange) 0%, #E07A2B 100%); color:#fff; border-color: transparent}
.kpi.accent .label{color: rgba(255,255,255,.8)}
.kpi.accent .value{color:#fff}
.kpi.accent .delta{color: rgba(255,255,255,.85)}
.kpi.navy{background: var(--navy); color:#fff; border-color:transparent}
.kpi.navy .label{color: var(--peach)}
.kpi.navy .value{color:#fff}

/* ===== Buttons ===== */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--orange); color: #fff;
  border: none; padding: 10px 16px;
  border-radius: var(--r-sm);
  font: 600 13px 'Segoe UI', system-ui, sans-serif;
  cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn:hover{background: var(--orange-dark); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration:none}
.btn:disabled{opacity: .55; cursor: not-allowed; transform:none; box-shadow:none}
.btn-navy{background: var(--navy)}
.btn-navy:hover{background: var(--navy-dark)}
.btn-outline{background: #fff; color: var(--navy); border: 1px solid var(--border)}
.btn-outline:hover{background: var(--bg); border-color: var(--navy); color: var(--navy)}
.btn-ghost{background: transparent; color: var(--muted)}
.btn-ghost:hover{background: var(--bg); color: var(--text)}
.btn-danger{background: var(--red)}
.btn-danger:hover{background: #B91C1C}
.btn-sm{padding: 6px 12px; font-size: 12px}
.btn-lg{padding: 13px 22px; font-size: 14px}
.btn-block{width:100%}

/* ===== Forms ===== */
.field{display:flex; flex-direction:column; gap:6px; margin-bottom: 12px}
.field label{font-size:12px; font-weight:600; color: var(--text)}
.field label .req{color: var(--red)}
.input, .select, .textarea{
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font: 400 14px 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus{
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(217,103,4,.12);
}
.textarea{resize: vertical; min-height: 80px; font-family: inherit}
.input-group{display:flex; gap:8px; align-items:center}
.input-group .input{flex:1}

/* ===== Filter bar ===== */
.filters{
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.filters > * { flex: 1 1 140px; min-width: 0; }
.filters > :first-child { flex: 2 1 240px; } /* search ocupa el doble */
.filters .input, .filters .select{padding: 8px 10px; font-size: 13px; width: 100%}

/* ===== Tables ===== */
.table-wrap{background: #fff; border:1px solid var(--border); border-radius: var(--r); overflow:hidden; overflow-x:auto}
.table{width:100%; border-collapse: collapse; font-size: 13px}
.table th, .table td{padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border)}
.table th{
  background: var(--bg); color: var(--muted);
  font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  position: sticky; top: 0;
}
.table tr:hover td{background: #FAFBFB; cursor: pointer}
.table tr:last-child td{border-bottom: none}
.table .actions-cell{white-space: nowrap; text-align: right}

/* ===== Badges / Pills ===== */
.pill{
  display:inline-flex; align-items:center; gap:4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg); color: var(--muted);
  white-space: nowrap;
}
.pill-green {background:#DCFCE7; color:#15803D}
.pill-yellow{background:#FEF3C7; color:#A16207}
.pill-orange{background: var(--peach-light); color: var(--orange-dark)}
.pill-red   {background:#FEE2E2; color:#B91C1C}
.pill-blue  {background:#DBEAFE; color:#1D4ED8}
.pill-navy  {background: var(--navy); color:#fff}

/* ===== Property cards (grid) ===== */
.prop-grid{display:grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px}
.prop-card{
  background: #fff; border:1px solid var(--border); border-radius: var(--r);
  overflow:hidden; cursor: pointer; transition: all .2s;
  display:flex; flex-direction:column;
}
.prop-card:hover{transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--orange)}
.prop-card .cover{
  width:100%; aspect-ratio: 16/10;
  background: var(--bg) center/cover no-repeat;
  position: relative;
}
.prop-card .cover .ph{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  color: var(--slate-light); font-size: 14px;
}
.prop-card .cover .status{
  position: absolute; top:10px; left:10px;
}
.prop-card .cover .publish-badge{
  position: absolute; top:10px; right:10px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight:700; letter-spacing:.3px;
  display:inline-flex; align-items:center; gap:4px;
  backdrop-filter: blur(6px);
}
.prop-card .cover .publish-badge.on{
  background: rgba(22, 163, 74, .92); color:#fff;
}
.prop-card .cover .publish-badge.off{
  background: rgba(15, 23, 42, .65); color:#fff;
}
.prop-card .cover .imgs{
  position: absolute; bottom:10px; right:10px;
  background: rgba(15,52,60,.85); color:#fff;
  padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight:600;
}
.prop-card .body{padding: 14px; flex:1; display:flex; flex-direction:column}
.prop-card .price{font-size: 18px; font-weight: 800; color: var(--navy); margin-bottom: 6px}
.prop-card .title{font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height:1.3}
.prop-card .loc{font-size: 12px; color: var(--muted); margin-bottom: 10px}
.prop-card .specs{display:flex; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted)}
.prop-card .specs span{display:flex; align-items:center; gap:4px}

/* ===== Modal ===== */
.modal-overlay{
  position: fixed; inset:0; background: rgba(15,52,60,.6); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open{display:flex}
.modal{
  background: #fff; border-radius: var(--r-lg); max-width: 720px; width:100%;
  max-height: 90vh; overflow-y:auto;
  box-shadow: var(--shadow-lg);
}
.modal-head{
  display:flex; justify-content:space-between; align-items:center;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top:0; background:#fff; z-index:1;
}
.modal-head h3{font-size:17px; font-weight:700; color: var(--navy)}
.modal-head .close{
  background:transparent; border:none; cursor:pointer; font-size:22px; color:var(--muted);
  width: 32px; height:32px; border-radius:50%;
}
.modal-head .close:hover{background: var(--bg); color: var(--text)}
.modal-body{padding: 22px}
.modal-foot{padding: 16px 22px; border-top: 1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap}

/* ===== Toast ===== */
.toast-container{position: fixed; bottom: 20px; right: 20px; z-index: 300; display:flex; flex-direction:column; gap:8px}
.toast{
  background: var(--navy); color:#fff;
  padding: 12px 18px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight:500;
  animation: toastIn .25s ease-out;
  display:flex; gap:8px; align-items:center;
}
.toast.error{background: var(--red)}
.toast.success{background: var(--green)}
@keyframes toastIn{from{transform: translateY(20px); opacity:0} to{transform: translateY(0); opacity:1}}

/* ===== Empty state ===== */
.empty{
  text-align:center; padding: 50px 20px;
  color: var(--muted);
}
.empty .icon{font-size: 48px; margin-bottom:10px}
.empty h3{font-size: 16px; color: var(--text); margin-bottom: 6px; font-weight:600}
.empty p{font-size: 13px; margin-bottom: 18px}

/* ===== Loading spinner ===== */
.spinner{
  display:inline-block; width:18px; height:18px;
  border:2px solid var(--border); border-top-color: var(--orange);
  border-radius:50%; animation: spin .7s linear infinite;
}
@keyframes spin{to{transform: rotate(360deg)}}
.loading-overlay{
  position: absolute; inset:0;
  background: rgba(255,255,255,.7);
  display:flex; align-items:center; justify-content:center;
  z-index: 5;
}

/* ===== Image gallery ===== */
.gallery{display:grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap:10px}
.gallery .img-thumb{
  position: relative; aspect-ratio: 1;
  border-radius: var(--r-sm); overflow:hidden; cursor: grab;
  border: 2px solid transparent;
  background: var(--bg) center/cover no-repeat;
  /* Sin esto el hold de 220ms que arma el arrastre dispara el menu de copiar
     de iOS y la seleccion de texto en desktop. touch-action:manipulation deja
     scrollear normal (el arrastre frena el scroll aparte, en JS). */
  -webkit-user-select:none; user-select:none;
  -webkit-touch-callout:none;
  touch-action: manipulation;
}
.gallery .img-thumb.cover{border-color: var(--orange)}
.gallery .img-thumb.dragging{
  opacity:.55; transform: scale(.94); cursor: grabbing;
  box-shadow: 0 8px 22px rgba(0,0,0,.28); z-index:2;
}
.gallery.reordering .img-thumb{cursor: grabbing}
.gallery .cover-badge{
  position:absolute; left:6px; top:6px;
  background: var(--orange); color:#fff;
  font-size:10px; font-weight:700; letter-spacing:.3px;
  padding:3px 7px; border-radius:4px;
}
.gallery-hint{font-size:12px; color: var(--muted); margin: -4px 0 10px}
.gallery .img-thumb .actions{
  position:absolute; top:6px; right:6px;
  display:flex; gap: 4px;
}
.gallery .img-thumb .actions button{
  background: rgba(15,52,60,.85); color:#fff; border:none;
  padding: 4px 8px; border-radius: 4px; font-size:11px; cursor:pointer;
}
.gallery .upload-tile{
  aspect-ratio:1; border: 2px dashed var(--border); border-radius: var(--r-sm);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  color: var(--muted); font-size: 12px; cursor:pointer; gap:6px;
}
.gallery .upload-tile:hover{border-color: var(--orange); color: var(--orange)}
.gallery .upload-tile .plus{font-size: 28px; line-height:1}

/* ===== Interaction timeline ===== */
.timeline{position:relative; padding-left: 26px}
.timeline::before{content:''; position:absolute; left:9px; top:6px; bottom:6px; width:2px; background: var(--border)}
.timeline-item{position:relative; padding-bottom: 14px}
.timeline-item:last-child{padding-bottom:0}
.timeline-item::before{
  content:''; position:absolute; left:-22px; top:6px;
  width:12px; height:12px; border-radius:50%;
  background: var(--orange); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--orange);
}
.timeline-item .when{font-size:11px; color: var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.5px}
.timeline-item .what{font-size: 13px; color: var(--text); margin: 2px 0 4px; font-weight:600}
.timeline-item .who{font-size: 12px; color: var(--muted)}
.timeline-item .note{font-size: 13px; color: var(--text); margin-top: 4px; background: var(--bg); padding: 8px 10px; border-radius: var(--r-sm)}

/* ===== Helpers ===== */
.row{display:flex; gap: 10px; align-items: center; flex-wrap: wrap}
.col{display:flex; flex-direction:column; gap:10px}
.mt-10{margin-top:10px}.mt-14{margin-top:14px}.mt-20{margin-top:20px}
.mb-10{margin-bottom:10px}.mb-14{margin-bottom:14px}.mb-20{margin-bottom:20px}
.text-muted{color: var(--muted)}
.text-sm{font-size: 12px}
.text-xs{font-size: 11px}
.text-right{text-align:right}
.hidden{display:none !important}
.gap-4{gap:4px}.gap-8{gap:8px}.gap-14{gap:14px}
.flex{display:flex}
.flex-1{flex:1}
.items-center{align-items:center}
.justify-between{justify-content:space-between}
.justify-end{justify-content:flex-end}
.flex-wrap{flex-wrap:wrap}
.w-full{width:100%}

/* ===== Mobile tweaks ===== */
@media (max-width: 720px){
  .nav{padding: 12px 14px; flex-wrap: wrap}
  .nav-brand{font-size: 15px}
  .nav-links{order:3; width:100%; justify-content: flex-start; overflow-x:auto}
  .nav-links::-webkit-scrollbar{display:none}
  .main{padding: 14px}
  .page-header{padding: 18px}
  .page-header h2{font-size: 18px}
  .card{padding: 16px}
  .filters > :first-child { flex: 1 1 100%; }     /* search en linea propia en mobile */
  .filters > *            { flex: 1 1 calc(50% - 5px); } /* resto en 2 columnas */
  .table th, .table td{padding: 10px 8px; font-size: 12px}
  .modal{max-height: 100vh; border-radius: 0}
}
