/* ══════════════════════════════════════════════════════════════════
   Dzerca — Portal de Inversores · Estilos base + mapa + login.
   Paleta oficial (identidad de la marca DZERCA).
   ══════════════════════════════════════════════════════════════════ */

:root {
    /* Marca */
    --dz-primary:      #7cb342;   /* verde principal */
    --dz-primary-dk:   #558b2f;
    --dz-primary-lt:   #f0f7e8;
    --dz-accent:       #fbc02d;
    --dz-danger:       #ec3013;

    /* Texto y superficies */
    --dz-white:        #ffffff;
    --dz-bg:           #f7faf5;
    --dz-surface:      #ffffff;
    --dz-text:         #1f2a24;
    --dz-text-muted:   #667267;
    --dz-border:       #dfe7db;
    --dz-border-dk:    #c7d3c1;

    --dz-radius:       10px;
    --dz-radius-sm:    6px;
    --dz-shadow-sm:    0 1px 3px rgba(31,42,36,.06);
    --dz-shadow:       0 4px 16px rgba(31,42,36,.08);
    --dz-shadow-lg:    0 12px 40px rgba(31,42,36,.14);

    --dz-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--dz-font);
    color: var(--dz-text);
    background: var(--dz-bg);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--dz-primary-dk); text-decoration: none; }
a:hover { color: var(--dz-primary); }

/* ══════════════════════════════════════════════════════════════
   Brand mark — logo oficial de Dzerca (wordmark horizontal)
═══════════════════════════════════════════════════════════════ */
.dz-brand-mark {
    display: inline-block;
    width: 150px; height: 46px;
    background: url("../img/dzerca-logo-color.png") left center / contain no-repeat;
    flex-shrink: 0;
    /* Oculta el texto placeholder ("DZ") por si queda de HTML antiguo. */
    font-size: 0; color: transparent;
    text-indent: -9999px;
    overflow: hidden;
}
/* Variantes de tamaño para distintos contextos del portal. */
.dz-brand-mark--lg { width: 220px; height: 68px; }
.dz-brand-mark--xl { width: 300px; height: 92px; }

/* ══════════════════════════════════════════════════════════════
   Login
═══════════════════════════════════════════════════════════════ */
.dz-page-login {
    background: linear-gradient(135deg, #ffffff 0%, var(--dz-primary-lt) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.dz-login-wrap {
    background: var(--dz-surface);
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius);
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--dz-shadow-lg);
}
.dz-login-brand { text-align: center; margin-bottom: 24px; }
.dz-login-brand .dz-brand-mark {
    margin: 0 auto 20px;
    width: 240px; height: 74px;
    background-position: center;   /* centrado horizontal en el login */
}
.dz-login-brand h1 { margin: 0 0 6px; font-size: 22px; color: var(--dz-text); font-weight: 700; }
.dz-login-sub { color: var(--dz-text-muted); font-size: 13px; margin: 0; }

.dz-login-form { display: flex; flex-direction: column; gap: 14px; }
.dz-field { display: flex; flex-direction: column; gap: 4px; }
.dz-field-lbl {
    font-size: 12px; color: var(--dz-text-muted); font-weight: 600;
    letter-spacing: 0.02em;
}
.dz-field input {
    width: 100%;
    padding: 11px 12px;
    background: #fff;
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius-sm);
    font: inherit; color: var(--dz-text);
    transition: border-color .15s, box-shadow .15s;
}
.dz-field input:focus {
    outline: none;
    border-color: var(--dz-primary);
    box-shadow: 0 0 0 3px rgba(124,179,66,.15);
}
.dz-btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 20px;
    background: var(--dz-primary);
    color: #fff;
    border: 0;
    border-radius: var(--dz-radius-sm);
    font-weight: 700; font-size: 15px;
    cursor: pointer;
    transition: background .15s;
    margin-top: 6px;
}
.dz-btn-primary:hover:not(:disabled) { background: var(--dz-primary-dk); }
.dz-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.dz-login-msg {
    font-size: 13px; text-align: center; min-height: 20px;
    padding: 6px 10px; border-radius: var(--dz-radius-sm);
}
.dz-login-msg.dz-msg-error {
    background: #fdecea; color: #a92218; border: 1px solid #f5b8b1;
}
.dz-login-msg.dz-msg-ok {
    background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7;
}

.dz-login-foot {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--dz-border);
    text-align: center;
    font-size: 12.5px;
    color: var(--dz-text-muted);
}

/* ══════════════════════════════════════════════════════════════
   Dashboard = mapa a pantalla completa
═══════════════════════════════════════════════════════════════ */
.dz-page-dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--dz-bg);
}

/* Topbar */
.dz-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    background: var(--dz-surface);
    border-bottom: 1px solid var(--dz-border);
    box-shadow: var(--dz-shadow-sm);
    z-index: 500;
}
.dz-topbar-brand { display: flex; align-items: center; gap: 12px; }
.dz-topbar-text .dz-topbar-title {
    font-weight: 700; font-size: 16px; line-height: 1.2;
}
.dz-topbar-text .dz-topbar-sub {
    font-size: 12px; color: var(--dz-text-muted); margin-top: 2px;
}
.dz-topbar-actions { display: flex; gap: 8px; }
.dz-topbar-btn {
    padding: 8px 14px;
    border-radius: var(--dz-radius-sm);
    font-size: 13px; font-weight: 600;
    color: var(--dz-text);
    background: var(--dz-primary-lt);
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s;
}
.dz-topbar-btn:hover { background: #e3edd6; color: var(--dz-text); }
.dz-topbar-btn--ghost {
    background: transparent;
    color: var(--dz-text-muted);
    border-color: var(--dz-border);
}
.dz-topbar-btn--ghost:hover { background: var(--dz-primary-lt); color: var(--dz-text); }

/* Barra de búsqueda */
.dz-searchbar {
    background: var(--dz-surface);
    border-bottom: 1px solid var(--dz-border);
    z-index: 500;
}
.dz-searchbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.4fr) auto;
    gap: 16px;
    align-items: end;
}
.dz-search-field { display: flex; flex-direction: column; gap: 4px; }
.dz-search-lbl {
    font-size: 11.5px; letter-spacing: 0.04em;
    color: var(--dz-text-muted); font-weight: 600;
    text-transform: uppercase;
}
.dz-input {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--dz-border);
    border-radius: var(--dz-radius-sm);
    font: inherit; font-size: 14px;
    color: var(--dz-text);
    transition: border-color .15s, box-shadow .15s;
}
.dz-input:focus {
    outline: none;
    border-color: var(--dz-primary);
    box-shadow: 0 0 0 3px rgba(124,179,66,.15);
}
select.dz-input {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23667267' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.dz-search-input-wrap {
    display: flex; gap: 6px;
}
.dz-search-input-wrap .dz-input { flex: 1; }
.dz-search-btn {
    padding: 10px 16px;
    background: var(--dz-primary);
    color: #fff; border: 0;
    border-radius: var(--dz-radius-sm);
    font-weight: 600; font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.dz-search-btn:hover:not(:disabled) { background: var(--dz-primary-dk); }
.dz-search-btn:disabled { opacity: .6; cursor: not-allowed; }

.dz-search-stats {
    font-size: 12.5px;
    color: var(--dz-text-muted);
    font-weight: 500;
    white-space: nowrap;
    padding-bottom: 10px;
}

/* Mapa */
.dz-map-shell {
    flex: 1;
    position: relative;
    min-height: 300px;
}
.dz-map {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    background: #eef2ea;
}

/* Marcador de cubierta */
.dz-marker {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    cursor: pointer;
    transition: transform .15s;
}
.dz-marker:hover { transform: scale(1.15); }

/* Popup del marcador */
.leaflet-popup-content-wrapper {
    border-radius: var(--dz-radius);
    box-shadow: var(--dz-shadow-lg);
}
.leaflet-popup-content { margin: 0; }
.dz-popup {
    padding: 14px 16px;
    font-family: var(--dz-font);
    color: var(--dz-text);
    min-width: 240px;
}
.dz-popup-head { margin-bottom: 8px; }
.dz-popup-title {
    font-weight: 700; font-size: 15px;
    line-height: 1.25;
}
.dz-popup-sub {
    font-size: 12px; color: var(--dz-text-muted);
    margin-top: 2px;
}
.dz-popup-dir {
    font-size: 12px; color: var(--dz-text-muted);
    padding: 8px 0;
    border-top: 1px solid var(--dz-border);
    border-bottom: 1px solid var(--dz-border);
    margin-bottom: 10px;
}
.dz-popup-kpis {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    margin-bottom: 12px;
}
.dz-popup-kpis > div {
    text-align: center;
    padding: 6px 4px;
    background: var(--dz-primary-lt);
    border-radius: var(--dz-radius-sm);
}
.dz-popup-kpis span {
    display: block;
    font-size: 10px; letter-spacing: 0.04em;
    color: var(--dz-text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}
.dz-popup-kpis strong {
    font-size: 13px; font-weight: 700;
    color: var(--dz-text);
    line-height: 1;
}
.dz-popup-btn {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: var(--dz-primary);
    color: #fff !important;
    border-radius: var(--dz-radius-sm);
    font-weight: 700; font-size: 13px;
    text-decoration: none;
    transition: background .15s;
}
.dz-popup-btn:hover { background: var(--dz-primary-dk); text-decoration: none; }

/* Toast */
.dz-toast {
    position: fixed;
    bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    background: var(--dz-text);
    color: #fff;
    border-radius: var(--dz-radius-sm);
    font-size: 13.5px; font-weight: 500;
    box-shadow: var(--dz-shadow-lg);
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 1000;
    max-width: 90vw;
}
.dz-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.dz-toast--error { background: var(--dz-danger); }
.dz-toast--warn  { background: var(--dz-accent); color: var(--dz-text); }

/* ══════════════════════════════════════════════════════════════
   Botón flotante de contacto (FAB) + panel deslizable
═══════════════════════════════════════════════════════════════ */
.dz-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px; height: 60px;
    border: 0; border-radius: 50%;
    background: var(--dz-primary);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(31,42,36,.28), 0 2px 6px rgba(31,42,36,.14);
    transition: background .15s, transform .2s, box-shadow .2s, opacity .2s;
    z-index: 900;
}
.dz-fab:hover {
    background: var(--dz-primary-dk);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(31,42,36,.34), 0 3px 8px rgba(31,42,36,.16);
}
.dz-fab:active { transform: translateY(0); }
.dz-fab.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85) translateY(10px);
}

/* Backdrop */
.dz-contacto-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31,42,36,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 950;
}
.dz-contacto-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Panel */
.dz-contacto-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: var(--dz-surface);
    border-radius: var(--dz-radius);
    box-shadow: 0 20px 60px rgba(31,42,36,.28), 0 4px 12px rgba(31,42,36,.14);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: transform .22s cubic-bezier(.2,.9,.3,1.2), opacity .2s;
    z-index: 1000;
}
.dz-contacto-panel.is-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.dz-contacto-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 14px;
    background: var(--dz-primary-lt);
    border-bottom: 1px solid var(--dz-border);
}
.dz-contacto-title {
    font-weight: 700; font-size: 17px; line-height: 1.25;
    color: var(--dz-text);
}
.dz-contacto-sub {
    margin-top: 4px;
    font-size: 12.5px; color: var(--dz-text-muted);
}
.dz-contacto-close {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--dz-text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.dz-contacto-close:hover {
    background: rgba(31,42,36,.08);
    color: var(--dz-text);
}
.dz-contacto-body {
    padding: 14px 12px 18px;
    display: flex; flex-direction: column; gap: 4px;
    overflow-y: auto;
}
.dz-contacto-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px;
    border-radius: var(--dz-radius-sm);
    color: var(--dz-text) !important;
    text-decoration: none;
    transition: background .12s;
}
.dz-contacto-item:hover {
    background: var(--dz-primary-lt);
    color: var(--dz-text) !important;
}
.dz-contacto-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--dz-primary-lt);
    color: var(--dz-primary-dk);
    display: flex; align-items: center; justify-content: center;
}
.dz-contacto-item:hover .dz-contacto-icon {
    background: #fff;
    color: var(--dz-primary-dk);
}
.dz-contacto-text {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.dz-contacto-lbl {
    font-size: 11px; letter-spacing: 0.04em;
    color: var(--dz-text-muted);
    text-transform: uppercase; font-weight: 600;
}
.dz-contacto-val {
    font-size: 14px; font-weight: 600;
    color: var(--dz-text);
    word-break: break-word;
}
.dz-contacto-foot {
    margin: 12px 12px 0;
    padding: 12px;
    background: #f9fbf6;
    border: 1px dashed var(--dz-border);
    border-radius: var(--dz-radius-sm);
    font-size: 12px; line-height: 1.5;
    color: var(--dz-text-muted);
}

/* Responsive */
@media (max-width: 720px) {
    .dz-topbar { padding: 10px 14px; }
    .dz-topbar-text .dz-topbar-title { font-size: 14px; }
    .dz-topbar-text .dz-topbar-sub { display: none; }
    .dz-brand-mark { width: 120px; height: 38px; }
    .dz-searchbar-inner {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 14px;
    }
    .dz-search-stats { padding-bottom: 0; }
    .dz-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
    .dz-contacto-panel { right: 16px; bottom: 16px; left: 16px; width: auto; }
}
