/* ============================================
   GESINMO - Estilos principales
   ============================================ */

:root {
  --gesinmo-primary: #1B3A5C;
  --gesinmo-secondary: #2E7DAF;
  --gesinmo-accent: #E8A020;
  --gesinmo-dark: #0F2237;
  --gesinmo-light: #F0F4F8;
  --gesinmo-sidebar: #1a2035;
  --gesinmo-sidebar-hover: #252d48;
  --gesinmo-success: #198754;
  --sidebar-width: 260px;
  --header-height: 60px;
}

/* ---- GLOBAL ---- */
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f0f2f5; color: #2c3e50; }
a { color: var(--gesinmo-secondary); text-decoration: none; }
a:hover { color: var(--gesinmo-primary); }

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-width);
  height: 100vh; background: var(--gesinmo-sidebar);
  display: flex; flex-direction: column; z-index: 1000;
  transition: transform 0.3s ease; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 40px; height: 40px; background: var(--gesinmo-accent);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.sidebar-logo .logo-text { color: #fff; font-size: 20px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .logo-sub { color: rgba(255,255,255,0.5); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; }
.sidebar-user {
  padding: 15px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gesinmo-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: #fff; font-size: 14px; flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { color: rgba(255,255,255,0.5); font-size: 11px; }

.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section-title {
  padding: 10px 20px 5px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 1.5px; color: rgba(255,255,255,0.35); font-weight: 600;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: rgba(255,255,255,0.7); font-size: 13.5px; border-radius: 0;
  transition: all 0.2s; position: relative;
}
.sidebar-nav .nav-link:hover { background: var(--gesinmo-sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
  background: rgba(46,125,175,0.25); color: #fff;
  border-left: 3px solid var(--gesinmo-accent);
}
.sidebar-nav .nav-link .nav-icon { width: 18px; text-align: center; font-size: 14px; }
.sidebar-nav .nav-link .badge { font-size: 10px; }

/* ---- MAIN CONTENT ---- */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 999;
  background: #fff; border-bottom: 1px solid #e9ecef;
  height: var(--header-height); display: flex; align-items: center;
  padding: 0 24px; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.topbar .page-title { font-size: 16px; font-weight: 600; color: var(--gesinmo-primary); flex: 1; }
.topbar .topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar .btn-icon {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: #f8f9fa; color: #6c757d; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.2s; position: relative;
}
.topbar .btn-icon:hover { background: #e9ecef; color: var(--gesinmo-primary); }
.notif-badge {
  position: absolute; top: -2px; right: -2px; width: 18px; height: 18px;
  background: #dc3545; color: #fff; border-radius: 50%; font-size: 10px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

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

/* ---- CARDS ---- */
.card { border: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.card-header { background: #fff; border-bottom: 1px solid #f0f0f0; border-radius: 12px 12px 0 0 !important; padding: 16px 20px; }
.card-header h5 { margin: 0; font-size: 15px; font-weight: 600; color: var(--gesinmo-primary); }

/* ---- STAT CARDS ---- */
.stat-card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07); display: flex;
  align-items: center; gap: 16px; transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--gesinmo-primary); }
.stat-card .stat-label { font-size: 12px; color: #6c757d; font-weight: 500; }
.stat-card .stat-change { font-size: 11px; font-weight: 600; }

/* ---- PROPERTY CARDS (Public) ---- */
.piso-card {
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 3px 12px rgba(0,0,0,0.09); transition: all 0.3s;
  height: 100%;
}
.piso-card:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,0.15); }
.piso-card .piso-img {
  width: 100%; height: 220px; object-fit: cover; position: relative; overflow: hidden;
}
.piso-card .piso-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.piso-card:hover .piso-img img { transform: scale(1.05); }
.piso-card .piso-estado-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.piso-card .piso-precio {
  position: absolute; bottom: 0; right: 0;
  background: var(--gesinmo-primary); color: #fff;
  padding: 6px 14px; font-size: 17px; font-weight: 700;
  border-radius: 12px 0 0 0;
}
.piso-card .piso-body { padding: 18px; }
.piso-card .piso-ref { font-size: 11px; color: #999; margin-bottom: 4px; }
.piso-card .piso-titulo { font-size: 15px; font-weight: 600; color: var(--gesinmo-primary); margin-bottom: 4px; line-height: 1.3; }
.piso-card .piso-dir { font-size: 12px; color: #888; margin-bottom: 12px; }
.piso-card .piso-features { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #555; border-top: 1px solid #f0f0f0; padding-top: 10px; }
.piso-card .piso-feature { display: flex; align-items: center; gap: 4px; }
.piso-card .piso-feature i { color: var(--gesinmo-secondary); width: 14px; text-align: center; }

/* ---- TABLES ---- */
.table-gesinmo thead th {
  background: var(--gesinmo-primary); color: #fff; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  border: none; padding: 12px 14px;
}
.table-gesinmo tbody tr { transition: background 0.15s; }
.table-gesinmo tbody tr:hover { background: #f8f9ff; }
.table-gesinmo td { padding: 11px 14px; vertical-align: middle; border-color: #f0f0f0; }

/* ---- FORMS ---- */
.form-control, .form-select {
  border-radius: 8px; border-color: #dee2e6; font-size: 14px; padding: 9px 12px;
}
.form-control:focus, .form-select:focus { border-color: var(--gesinmo-secondary); box-shadow: 0 0 0 3px rgba(46,125,175,0.15); }
.form-label { font-size: 13px; font-weight: 500; color: #555; margin-bottom: 5px; }
.input-group-text { background: #f8f9fa; border-color: #dee2e6; }

/* ---- BUTTONS ---- */
.btn { border-radius: 8px; font-size: 14px; font-weight: 500; padding: 8px 16px; }
.btn-primary { background: var(--gesinmo-secondary); border-color: var(--gesinmo-secondary); }
.btn-primary:hover { background: var(--gesinmo-primary); border-color: var(--gesinmo-primary); }
.btn-gesinmo { background: var(--gesinmo-primary); border-color: var(--gesinmo-primary); color: #fff; }
.btn-gesinmo:hover { background: var(--gesinmo-dark); color: #fff; }
.btn-accent { background: var(--gesinmo-accent); border-color: var(--gesinmo-accent); color: #fff; }
.btn-accent:hover { background: #d4911a; color: #fff; }
.btn-sm { font-size: 12px; padding: 5px 10px; }

/* ---- NAVBAR PUBLIC ---- */
.navbar-gesinmo {
  background: var(--gesinmo-primary); padding: 12px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.navbar-gesinmo .navbar-brand { font-size: 22px; font-weight: 800; color: #fff !important; }
.navbar-gesinmo .nav-link { color: rgba(255,255,255,0.85) !important; font-size: 14px; font-weight: 500; }
.navbar-gesinmo .nav-link:hover { color: var(--gesinmo-accent) !important; }
.navbar-gesinmo .btn-nav { background: var(--gesinmo-accent); color: #fff; border: none; border-radius: 8px; padding: 7px 18px; font-weight: 600; font-size: 14px; }
.navbar-gesinmo .btn-nav:hover { background: #d4911a; }

/* ---- HERO ---- */
.hero-section {
  background: linear-gradient(135deg, var(--gesinmo-primary) 0%, var(--gesinmo-secondary) 100%);
  padding: 80px 0; color: #fff; position: relative; overflow: hidden;
}
.hero-section::before {
  content: ''; position: absolute; top: -50%; right: -10%;
  width: 600px; height: 600px; border-radius: 50%;
  background: rgba(255,255,255,0.04); pointer-events: none;
}
.hero-section h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; }
.hero-section .lead { font-size: 1.1rem; opacity: 0.85; }

/* ---- FILTERS ---- */
.filter-bar {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07); margin-bottom: 24px;
}

/* ---- BREADCRUMB ---- */
.breadcrumb { font-size: 13px; margin: 0; }
.breadcrumb-item + .breadcrumb-item::before { color: #999; }

/* ---- PAGE HEADER ---- */
.page-header {
  background: #fff; border-radius: 12px; padding: 20px 24px;
  margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--gesinmo-primary); margin: 0; }

/* ---- ALERTS ---- */
.alert { border-radius: 10px; border: none; font-size: 14px; }

/* ---- MODALS ---- */
.modal-content { border-radius: 14px; border: none; }
.modal-header { border-bottom-color: #f0f0f0; }
.modal-footer { border-top-color: #f0f0f0; }

/* ---- LOGIN ---- */
.login-wrapper {
  min-height: 100vh; background: linear-gradient(135deg, var(--gesinmo-primary) 0%, var(--gesinmo-secondary) 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo { font-size: 28px; font-weight: 900; color: var(--gesinmo-primary); margin-bottom: 5px; }
.login-sub { font-size: 13px; color: #888; margin-bottom: 30px; }

/* ---- SCORING ---- */
.scoring-bar { height: 10px; border-radius: 5px; overflow: hidden; background: #e9ecef; }
.scoring-fill { height: 100%; border-radius: 5px; transition: width 0.5s; }

/* ---- FICHA SALIDA ---- */
.ficha-seccion { background: #f8f9fa; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.ficha-seccion-titulo { font-weight: 600; font-size: 14px; color: var(--gesinmo-primary); margin-bottom: 12px; border-bottom: 2px solid var(--gesinmo-accent); padding-bottom: 8px; }
.estado-selector .btn { font-size: 11px; padding: 4px 10px; }

/* ---- TIMELINE ---- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: #e9ecef; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--gesinmo-secondary);
}
.timeline-content { background: #fff; border-radius: 8px; padding: 12px 15px; box-shadow: 0 1px 4px rgba(0,0,0,0.07); }
.timeline-date { font-size: 11px; color: #999; margin-bottom: 4px; }

/* ---- SIDEBAR TOGGLE (mobile) ---- */
.sidebar-toggle { display: none; }
@media (max-width: 991.98px) {
  .sidebar-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
  .sidebar-overlay.show { display: block; }
}

/* ---- FOOTER (public) ---- */
.footer-public {
  background: var(--gesinmo-dark); color: rgba(255,255,255,0.7);
  padding: 40px 0 20px;
}
.footer-public h5 { color: #fff; font-weight: 700; }
.footer-public a { color: rgba(255,255,255,0.7); font-size: 14px; }
.footer-public a:hover { color: var(--gesinmo-accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 15px; margin-top: 25px; font-size: 13px; }

/* ---- UTILITIES ---- */
.text-gesinmo { color: var(--gesinmo-primary) !important; }
.text-accent { color: var(--gesinmo-accent) !important; }
.bg-gesinmo { background: var(--gesinmo-primary) !important; }
.bg-accent { background: var(--gesinmo-accent) !important; }
.border-gesinmo { border-color: var(--gesinmo-primary) !important; }
.rounded-xl { border-radius: 14px !important; }
.shadow-sm-custom { box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important; }
.cursor-pointer { cursor: pointer; }

/* ---- DROPZONE ---- */
.dropzone-area {
  border: 2px dashed #dee2e6; border-radius: 12px; padding: 40px;
  text-align: center; cursor: pointer; transition: all 0.2s; color: #6c757d;
}
.dropzone-area:hover, .dropzone-area.dragover { border-color: var(--gesinmo-secondary); background: #f0f8ff; color: var(--gesinmo-secondary); }
.dropzone-area i { font-size: 40px; margin-bottom: 10px; }

/* ---- CHAT/MESSAGES ---- */
.msg-list { max-height: 500px; overflow-y: auto; }
.msg-item { padding: 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.15s; }
.msg-item:hover { background: #f8f9ff; }
.msg-item.unread { background: #f0f7ff; }
.msg-item.unread .msg-subject { font-weight: 700; }
.msg-bubble { max-width: 80%; padding: 12px 16px; border-radius: 14px; margin-bottom: 10px; }
.msg-bubble.mine { background: var(--gesinmo-secondary); color: #fff; margin-left: auto; border-radius: 14px 14px 0 14px; }
.msg-bubble.other { background: #f0f0f0; border-radius: 14px 14px 14px 0; }

/* ---- CHARTS ---- */
.chart-container { position: relative; }

/* ---- PRINT ---- */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-wrapper { margin: 0 !important; }
  .card { box-shadow: none !important; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
.sidebar::-webkit-scrollbar-track { background: var(--gesinmo-sidebar); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
