/* ============================================
   LIRAMAR PORTAL - Estilos Principales
   Paleta: Azul marino + Arena + Turquesa
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* === VARIABLES === */
:root {
  --azul:       #0D2B4E;
  --azul-med:   #1A4A7A;
  --azul-light: #2E7AB6;
  --turquesa:   #00B4D8;
  --arena:      #F5F0E8;
  --arena-dark: #E8DFC8;
  --blanco:     #FFFFFF;
  --gris:       #8A97A4;
  --gris-light: #F0F4F7;
  --success:    #2ECC71;
  --warning:    #F39C12;
  --danger:     #E74C3C;
  --text:       #1A2635;
  --text-light: #5A6A7A;

  --sidebar-w:  260px;
  --header-h:   60px;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(13,43,78,.10);
  --shadow-lg:  0 8px 32px rgba(13,43,78,.16);
  --transition: all .22s cubic-bezier(.4,0,.2,1);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gris-light);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === LOGIN === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-med) 50%, #0A4060 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2300B4D8' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-waves {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120'%3E%3Cpath fill='%2300B4D8' fill-opacity='0.15' d='M0,60 C240,100 480,20 720,60 C960,100 1200,20 1440,60 L1440,120 L0,120 Z'/%3E%3Cpath fill='%2300B4D8' fill-opacity='0.08' d='M0,80 C360,40 720,120 1080,80 C1260,60 1380,90 1440,80 L1440,120 L0,120 Z'/%3E%3C/svg%3E") no-repeat bottom;
  background-size: cover;
}
.login-card {
  background: var(--blanco);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
  animation: slideUp .5s ease;
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img { height: 70px; }
.login-logo h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  color: var(--azul);
  margin-top: 10px;
  letter-spacing: .5px;
}
.login-logo p {
  font-size: .82rem;
  color: var(--gris);
  margin-top: 4px;
}

/* === LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--azul);
  color: var(--blanco);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--azul-light); border-radius: 4px; }

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo img { height: 38px; }
.sidebar-logo span {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blanco);
  letter-spacing: .5px;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.15);
}
.sidebar-user .name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--blanco);
}
.sidebar-user .role {
  font-size: .75rem;
  color: var(--turquesa);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-section-title {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.35);
  padding: 14px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 400;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--blanco);
}
.nav-item.active {
  background: rgba(0,180,216,.15);
  color: var(--turquesa);
  border-left-color: var(--turquesa);
  font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--turquesa);
  color: var(--azul);
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  width: 100%;
  padding: 8px 0;
}
.btn-logout:hover { color: var(--danger); }

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--blanco);
  border-bottom: 1px solid var(--arena-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--azul);
  font-weight: 700;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-date {
  font-size: .8rem;
  color: var(--gris);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--azul);
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* === CARDS === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--blanco);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--turquesa);
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.verde { border-left-color: var(--success); }
.stat-card.naranja { border-left-color: var(--warning); }
.stat-card.rojo { border-left-color: var(--danger); }
.stat-card.azul { border-left-color: var(--azul-light); }
.stat-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gris);
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--azul);
  line-height: 1;
}
.stat-sub {
  font-size: .78rem;
  color: var(--text-light);
  margin-top: 5px;
}

.card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--arena-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--azul);
}
.card-body { padding: 20px 22px; }

/* === FORMS === */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .5px;
}
input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--arena-dark);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--text);
  background: var(--blanco);
  transition: var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--turquesa);
  box-shadow: 0 0 0 3px rgba(0,180,216,.12);
}
textarea { resize: vertical; min-height: 80px; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--azul);
  color: var(--blanco);
}
.btn-primary:hover { background: var(--azul-med); transform: translateY(-1px); }
.btn-secondary {
  background: var(--turquesa);
  color: var(--blanco);
}
.btn-secondary:hover { background: #0095B8; }
.btn-success  { background: var(--success); color: var(--blanco); }
.btn-danger   { background: var(--danger);  color: var(--blanco); }
.btn-warning  { background: var(--warning); color: var(--blanco); }
.btn-outline  { background: transparent; color: var(--azul); border: 1.5px solid var(--azul); }
.btn-outline:hover { background: var(--azul); color: var(--blanco); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-xs { padding: 4px 8px; font-size: .75rem; border-radius: 5px; }
.btn-icon { padding: 8px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; }

/* === TABLE === */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  background: var(--azul);
  color: var(--blanco);
  padding: 12px 14px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
}
thead th:first-child { border-radius: 0; }
tbody tr {
  border-bottom: 1px solid var(--gris-light);
  transition: var(--transition);
}
tbody tr:hover { background: rgba(0,180,216,.04); }
tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }
tbody td:last-child { white-space: nowrap; }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-disponible { background: #D4EDDA; color: #155724; }
.badge-separado   { background: #FFF3CD; color: #856404; }
.badge-vendido    { background: #F8D7DA; color: #721C24; }
.badge-prospecto  { background: #D1ECF1; color: #0C5460; }
.badge-inactivo   { background: #E2E3E5; color: #383D41; }
.badge-activa     { background: #D4EDDA; color: #155724; }
.badge-completada { background: #CCE5FF; color: #004085; }
.badge-cancelada  { background: #F8D7DA; color: #721C24; }

/* === SEARCH BAR === */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris);
  width: 16px;
  height: 16px;
}
.search-input-wrap input {
  padding-left: 38px;
  width: 100%;
}

/* === COTIZACION === */
.cotizacion-result {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-med) 100%);
  color: var(--blanco);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
}
.cotizacion-result h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.2);
  padding-bottom: 10px;
}
.cotizacion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.cotizacion-item label {
  color: rgba(255,255,255,.65);
  font-size: .72rem;
  margin-bottom: 4px;
  letter-spacing: .8px;
}
.cotizacion-item .value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blanco);
}
.cotizacion-item .value.big {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  color: var(--turquesa);
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,43,78,.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--blanco);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}
.modal.modal-lg { max-width: 720px; }
@keyframes modalIn {
  from { transform: scale(.94) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--arena-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  color: var(--azul);
  font-weight: 700;
}
.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--arena-dark);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-close-modal {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gris);
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}
.btn-close-modal:hover { color: var(--danger); background: #fff0f0; }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .87rem;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #D4EDDA; color: #155724; border-left: 4px solid var(--success); }
.alert-error   { background: #F8D7DA; color: #721C24; border-left: 4px solid var(--danger); }
.alert-info    { background: #D1ECF1; color: #0C5460; border-left: 4px solid var(--turquesa); }
.alert-warning { background: #FFF3CD; color: #856404; border-left: 4px solid var(--warning); }

/* === LOADING === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--gris);
  font-size: .9rem;
}
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--arena-dark);
  border-top-color: var(--turquesa);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gris);
}
.empty-state svg { width: 52px; height: 52px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: .9rem; }

/* === DETAIL VIEW === */
.detail-section { margin-bottom: 22px; }
.detail-section h4 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--azul);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--arena-dark);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.detail-item label {
  display: block;
  font-size: .73rem;
  color: var(--gris);
  font-weight: 500;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.detail-item span {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
}

/* === TABS === */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--arena-dark);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 9px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .87rem;
  font-weight: 500;
  color: var(--gris);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn.active {
  color: var(--azul);
  border-bottom-color: var(--turquesa);
  font-weight: 700;
}
.tab-btn:hover { color: var(--azul); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* === LOTE GRID === */
.lotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.lote-card {
  border: 2px solid var(--arena-dark);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  background: var(--blanco);
}
.lote-card:hover { border-color: var(--turquesa); transform: translateY(-2px); }
.lote-card.disponible { border-color: var(--success); }
.lote-card.separado  { border-color: var(--warning);  background: #fffdf0; }
.lote-card.vendido   { border-color: var(--danger);   background: #fff5f5; opacity: .85; cursor: not-allowed; }
.lote-card .lote-id  { font-weight: 700; color: var(--azul); font-size: .9rem; }
.lote-card .lote-area { font-size: .75rem; color: var(--gris); margin: 3px 0; }
.lote-card .lote-precio { font-size: .8rem; font-weight: 600; color: var(--text); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .cotizacion-grid { grid-template-columns: 1fr 1fr; }
  .lotes-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar { padding: 0 16px; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }

/* === MISC === */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--arena-dark); margin: 16px 0; }

.color-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.dot-verde   { background: var(--success); }
.dot-naranja { background: var(--warning); }
.dot-rojo    { background: var(--danger);  }
.dot-azul    { background: var(--turquesa); }
