/* Alma Vial - estilos propios sobre Bootstrap 5
   El menu lateral replica el de AS Vial: mismas medidas y comportamiento. */

:root {
    --av-sidebar:     #1a1a2e;
    --av-acento:      #c8925a;   /* tierra clara: se lee sobre el azul oscuro */
    --av-tierra:      #8a5a2b;
    --av-tierra-osc:  #6f4722;
    --av-arena:       #f1ece5;
    --av-borde:       #ddd6cc;
    --av-texto:       #1f1d1a;
    --av-ancho:       250px;
}

body {
    background: #f7f5f2;
    color: var(--av-texto);
    font-size: .95rem;
    margin-left: var(--av-ancho);
}

/* ------------------------------------------------------------------ menu */
#sidebar {
    width: var(--av-ancho);
    min-height: 100vh;
    background: var(--av-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}

#sidebar .sidebar-brand {
    padding: 20px 20px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: .3px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    text-decoration: none;
    display: block;
}
#sidebar .sidebar-brand small {
    display: block;
    font-size: .7rem;
    color: rgba(255,255,255,.5);
    font-weight: 400;
    letter-spacing: 0;
}

#sidebar .sidebar-user {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    line-height: 1.3;
}
.sidebar-user-nombre {
    display: block;
    color: rgba(255,255,255,.85);
    font-size: .875rem;
}
.sidebar-user-rol {
    display: block;
    color: rgba(255,255,255,.45);
    font-size: .75rem;
}

#sidebar .sidebar-sociedad {
    padding: 10px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
#sidebar .sidebar-sociedad label {
    display: block;
    color: rgba(255,255,255,.4);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
#sidebar .sidebar-sociedad select {
    width: 100%;
    background: rgba(255,255,255,.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: .85rem;
}
#sidebar .sidebar-sociedad select option { color: #000; }
.sidebar-sociedad-fija {
    color: rgba(255,255,255,.8);
    font-size: .875rem;
}

#sidebar .sidebar-menu {
    overflow-y: auto;
    flex: 1;
}

.cat-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 20px;
    color: rgba(255,255,255,.6);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background .2s, color .2s;
    border-left: 3px solid transparent;
}
.cat-toggle:hover {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.9);
}
.cat-toggle.open {
    color: #fff;
    background: rgba(255,255,255,.06);
    border-left-color: var(--av-acento);
}
.cat-toggle .arrow {
    font-size: 1rem;
    color: rgba(255,255,255,.3);
    font-weight: 300;
    line-height: 1;
}
.cat-toggle.open .arrow { color: rgba(255,255,255,.5); }

.cat-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease;
}
.cat-items.open { max-height: 600px; }

.cat-items .nav-link {
    padding: 8px 20px 8px 36px;
    color: rgba(255,255,255,.65);
    font-size: .875rem;
    display: block;
    text-decoration: none;
    transition: background .2s, color .2s;
    border-left: 3px solid transparent;
}
.cat-items a.nav-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-left-color: var(--av-acento);
}
.cat-items .nav-link.active {
    background: rgba(200,146,90,.18);
    color: #fff;
    border-left-color: var(--av-acento);
}
/* Items todavia no desarrollados: se ven, pero apagados */
.cat-items .nav-link.pendiente {
    color: rgba(255,255,255,.25);
    cursor: default;
}

#sidebar .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
}

/* ------------------------------------------------------- movil y overlay */
#topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1001;
    background: var(--av-sidebar);
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
}
#topbar .brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}
#topbar button {
    background: none;
    border: 0;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
}

#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}

.main-content { min-height: 100vh; }

@media (max-width: 992px) {
    #sidebar { transform: translateX(calc(-1 * var(--av-ancho))); }
    #sidebar.open { transform: translateX(0); }
    #topbar { display: flex; }
    body { margin-left: 0; padding-top: 56px; }
    #sidebarOverlay.open { display: block; }
}

/* ------------------------------------------------------------- contenido */
.card { border: 1px solid var(--av-borde); }
.card-header {
    background: var(--av-arena);
    border-bottom: 1px solid var(--av-borde);
    font-weight: 600;
}
.table thead th {
    background: var(--av-arena);
    border-bottom: 2px solid var(--av-borde);
    font-weight: 600;
    white-space: nowrap;
}
.table-hover tbody tr:hover { background: #fbf9f6; }

.btn-tierra {
    background: var(--av-tierra);
    border-color: var(--av-tierra);
    color: #fff;
}
.btn-tierra:hover {
    background: var(--av-tierra-osc);
    border-color: var(--av-tierra-osc);
    color: #fff;
}

.av-pie { color: #8b8377; font-size: .8rem; }

/* Cinta de entorno: que nadie confunda staging con produccion */
.av-entorno {
    background: #b3261e;
    color: #fff;
    text-align: center;
    font-size: .75rem;
    letter-spacing: .5px;
    padding: 2px;
}

/* ---------------------------------------------------------------- login */
.av-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #16162a 0%, #1a1a2e 55%, #2a2a44 100%);
    margin-left: 0;
}
body.login { margin-left: 0; }
.av-login-caja {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.av-login-titulo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--av-sidebar);
}
