/* Cáscara del portal: sidebar, header móvil y área de contenido.
 *
 * Vivía pegado como <style> dentro de `app/web/templates/index.html`, así que
 * el portal veterinario nació sin él y el menú salía sin formato. Extraído a
 * un archivo para que los dos portales (negocios y veterinario) usen el mismo.
 * No lleva colores propios: todo sale de los tokens (--primary, --border, …),
 * por eso en el portal veterinario se pinta teal solo.
 */

/* ── User Sidebar ── */
.user-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-card-solid);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}

.user-sidebar.open {
    transform: translateX(0)
}

.user-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 899;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s
}

.user-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto
}

.user-sidebar-brand {
    display: flex;
    justify-content: center;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    height: 72px;
    width: auto;
}

.user-sidebar-brand-text {
    font-size: 17px;
    font-weight: 400;
    color: var(--text-secondary);
}

.user-sidebar-brand-text strong {
    color: var(--primary);
    font-weight: 700;
}

.user-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.user-sidebar-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.user-sidebar-item::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 2px;
    transform: translateY(-50%);
    transition: height .25s cubic-bezier(0.22, 1, 0.36, 1), opacity .2s;
    opacity: 0;
}

.user-sidebar-item:hover {
    background: rgba(249, 115, 22, .08);
    color: var(--text);
    transform: translateX(2px);
}

.user-sidebar-item.active {
    background: rgba(249, 115, 22, .12);
    color: var(--primary);
    font-weight: 600;
}

.user-sidebar-item.active::before {
    height: 60%;
    opacity: 1;
}

.user-sidebar-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform .2s ease;
}

.user-sidebar-item.active svg {
    transform: scale(1.05);
}

.sidebar-section-divider {
    margin: 14px 6px 10px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.sidebar-section-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-left: 14px;
}

.user-sidebar-nav::-webkit-scrollbar { width: 6px; }
.user-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 3px;
}
.user-sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(249, 115, 22, 0.4); }

.user-sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Versión del portal — discreta, al pie. Sirve para saber de un
   vistazo si el navegador está corriendo el build más reciente. */
.sidebar-version {
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text-muted, #94a3b8);
    opacity: .55;
    user-select: none;
    padding: 2px 0 1px;
    font-variant-numeric: tabular-nums;
}
.sidebar-version:hover { opacity: .9; }

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
    font-family: inherit;
    color: var(--text);
}
.sidebar-user-card:hover {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.35);
}
.sidebar-user-card:active { transform: translateY(0); }

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    letter-spacing: -0.2px;
    box-shadow: 0 2px 8px -2px rgba(249, 115, 22, 0.5);
    overflow: hidden;
}
.sidebar-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.sidebar-user-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.sidebar-user-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-chev {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform .2s ease, color .2s ease;
}
.sidebar-user-card:hover .sidebar-user-chev {
    color: var(--primary);
    transform: translateX(2px);
}

.sidebar-footer-actions {
    display: flex;
    gap: 6px;
}
.sidebar-icon-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
}
.sidebar-icon-btn svg {
    width: 16px;
    height: 16px;
}
.sidebar-icon-btn:hover {
    background: rgba(249, 115, 22, 0.08);
    color: var(--primary);
    border-color: rgba(249, 115, 22, 0.35);
}
.sidebar-icon-btn:active { transform: scale(0.94); }
.sidebar-icon-btn-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.35);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    height: 36px;
    width: auto;
    border-radius: 8px;
    background: #fff;
    padding: 4px 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.user-sidebar-toggle {
    display: flex;
}

/* Desktop: sidebar always visible, shift layout */
@media(min-width:768px) {
    .user-sidebar {
        transform: translateX(0);
    }

    .user-sidebar-overlay {
        display: none !important;
    }

    .mobile-only {
        display: none !important;
    }

    .app-content {
        margin-left: 260px;
        max-width: min(1440px, calc(100vw - 260px));
    }

    .user-sidebar-toggle {
        display: none;
    }
}
